You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/06/10 15:01:56 UTC
[pulsar] 12/12: [fix][txn] fix NPE of TransactionMetaStoreHandler (#15840)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 3411bf211761dbbdf9f78a5b768ca30a52363148
Author: congbo <39...@users.noreply.github.com>
AuthorDate: Thu Jun 9 11:55:18 2022 +0800
[fix][txn] fix NPE of TransactionMetaStoreHandler (#15840)
(cherry picked from commit f9b0912dc3b7768c604b3f1c039c4068bb0d5810)
---
.../apache/pulsar/client/impl/TransactionMetaStoreHandler.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
index 5b91a1cd84b..82fc89ca0a1 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
@@ -129,9 +129,6 @@ public class TransactionMetaStoreHandler extends HandlerState implements Connect
return;
}
- connectionHandler.setClientCnx(cnx);
- cnx.registerTransactionMetaStoreHandler(transactionCoordinatorId, this);
-
// if broker protocol version < 19, don't send TcClientConnectRequest to broker.
if (cnx.getRemoteEndpointProtocolVersion() > ProtocolVersion.v18.getValue()) {
long requestId = client.newRequestId();
@@ -145,6 +142,8 @@ public class TransactionMetaStoreHandler extends HandlerState implements Connect
cnx.channel().close();
}
+ connectionHandler.setClientCnx(cnx);
+ cnx.registerTransactionMetaStoreHandler(transactionCoordinatorId, this);
if (!this.connectFuture.isDone()) {
this.connectFuture.complete(null);
}
@@ -168,6 +167,9 @@ public class TransactionMetaStoreHandler extends HandlerState implements Connect
} else {
if (!changeToReadyState()) {
cnx.channel().close();
+ } else {
+ connectionHandler.setClientCnx(cnx);
+ cnx.registerTransactionMetaStoreHandler(transactionCoordinatorId, this);
}
this.connectFuture.complete(null);
}