This is an automated email from the ASF dual-hosted git repository.

tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git


The following commit(s) were added to refs/heads/main by this push:
     new 33f2312  Fix for intermittent CI failure in transaction timout 
handling tests
33f2312 is described below

commit 33f231272b9a671cab2acef70a1801edb3141e5d
Author: Timothy Bish <tabish...@gmail.com>
AuthorDate: Thu Apr 22 14:21:35 2021 -0400

    Fix for intermittent CI failure in transaction timout handling tests
    
    Use a unique name for the coordinator link as the old instance can still
    be handling closure after timeout processing for various phases of the
    transaction life-cycle.
---
 .../qpid/protonj2/client/impl/ClientLocalTransactionContext.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientLocalTransactionContext.java
 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientLocalTransactionContext.java
index 2661b65..3b2a8de 100644
--- 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientLocalTransactionContext.java
+++ 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientLocalTransactionContext.java
@@ -17,6 +17,7 @@
 package org.apache.qpid.protonj2.client.impl;
 
 import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.qpid.protonj2.client.Session;
 import org.apache.qpid.protonj2.client.exceptions.ClientException;
@@ -63,6 +64,7 @@ final class ClientLocalTransactionContext implements 
ClientTransactionContext {
     private final String DISCHARGE_FUTURE_NAME = "Discharge:Future";
     private final String START_TRANSACTION_MARKER = "Transaction:Start";
 
+    private final AtomicInteger coordinatorCounter = new AtomicInteger();
     private final ClientSession session;
 
     private Transaction<TransactionController> currentTxn;
@@ -252,7 +254,7 @@ final class ClientLocalTransactionContext implements 
ClientTransactionContext {
             Source source = new Source();
             source.setOutcomes(Arrays.copyOf(SUPPORTED_OUTCOMES, 
SUPPORTED_OUTCOMES.length));
 
-            TransactionController txnController = 
session.getProtonSession().coordinator("Coordinator:" + session.id());
+            TransactionController txnController = 
session.getProtonSession().coordinator(nextCoordinatorId());
             txnController.setSource(source)
                          .setCoordinator(coordinator)
                          .declaredHandler(this::handleTransactionDeclared)
@@ -438,6 +440,10 @@ final class ClientLocalTransactionContext implements 
ClientTransactionContext {
         }
     }
 
+    private String nextCoordinatorId() {
+        return session.id() + ":" + coordinatorCounter.incrementAndGet();
+    }
+
     private void handleParentEndpointClosed(TransactionController 
txnController) {
         txnController.close();
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to