You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/28 14:19:58 UTC

[GitHub] [pulsar] lhotari commented on a change in pull request #10407: [Transaction] Fix transaction buffer client channel not active problem.

lhotari commented on a change in pull request #10407:
URL: https://github.com/apache/pulsar/pull/10407#discussion_r622227403



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TransactionBufferHandlerImpl.java
##########
@@ -116,24 +124,26 @@ public TransactionBufferHandlerImpl(PulsarClient pulsarClient,
 
     private CompletableFuture<TxnID> endTxn(long requestId, String topic, ByteBuf cmd, CompletableFuture<TxnID> cb) {
         OpRequestSend op = OpRequestSend.create(requestId, topic, cmd, cb);
-        pendingRequests.put(requestId, op);
-        cmd.retain();
         try {
             cache.get(topic).whenComplete((clientCnx, throwable) -> {
                 if (throwable == null) {
-                    try {
+                    if (clientCnx.ctx().channel().isActive()) {
                         clientCnx.registerTransactionBufferHandler(TransactionBufferHandlerImpl.this);
+                        synchronized (TransactionBufferHandlerImpl.class) {

Review comment:
       It seems odd to use the Class object as an object monitor. Is this intentional? 
   Did you mean to have `synchronized (TransactionBufferHandlerImpl.this) {` instead?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org