Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ public CompletableFuture<TransactionMeta> getTransactionMeta(TxnID txnID) {
return CompletableFuture.completedFuture(null);
}

@VisibleForTesting
public void setPublishFuture(CompletableFuture<Position> publishFuture) {
this.publishFuture = publishFuture;
}

@VisibleForTesting
public CompletableFuture<Position> getPublishFuture() {
return publishFuture;
Expand Down Expand Up @@ -298,7 +303,7 @@ public CompletableFuture<Position> appendBufferToTxn(TxnID txnId, long sequenceI
"Transaction Buffer recover failed, the current state is: " + getState()));
}
}).whenComplete(((position, throwable) -> buffer.release()));
publishFuture = future;
setPublishFuture(future);
return future;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,20 @@
*/
package org.apache.pulsar.broker.transaction.buffer.utils;

import java.util.concurrent.CompletableFuture;
import lombok.Setter;
import org.apache.bookkeeper.mledger.Position;
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
import org.apache.pulsar.broker.transaction.buffer.impl.TopicTransactionBuffer;

public class TransactionBufferTestImpl extends TopicTransactionBuffer {
@Setter
public CompletableFuture<Void> transactionBufferFuture = null;
@Setter
public State state = null;
@Setter
public CompletableFuture<Position> publishFuture = null;

public TransactionBufferTestImpl(PersistentTopic topic) {
super(topic);
}

@Override
public CompletableFuture<Void> getTransactionBufferFuture() {
return transactionBufferFuture == null ? super.getTransactionBufferFuture() : transactionBufferFuture;
}

@Override
public State getState() {
return state == null ? super.getState() : state;
}

@Override
public CompletableFuture<Position> getPublishFuture() {
return publishFuture == null ? super.getPublishFuture() : publishFuture;
}
}
Loading