You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2023/06/21 19:32:17 UTC

[qpid-protonj2] branch main updated: PROTON-2744 Fix client close if triggered by test script

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 67bda19c PROTON-2744 Fix client close if triggered by test script
67bda19c is described below

commit 67bda19c36310226322134c7c5f014e7a32d6a7d
Author: Timothy Bish <ta...@gmail.com>
AuthorDate: Wed Jun 21 15:31:42 2023 -0400

    PROTON-2744 Fix client close if triggered by test script
    
    Don't wait on event loop close if the close was triggered from the test
    script as that will be running in the event loop
---
 .../apache/qpid/protonj2/test/driver/netty/netty4/Netty4Client.java | 6 ++++++
 .../apache/qpid/protonj2/test/driver/netty/netty5/Netty5Client.java | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty4/Netty4Client.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty4/Netty4Client.java
index 2f2eddca..3bb61d50 100644
--- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty4/Netty4Client.java
+++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty4/Netty4Client.java
@@ -127,6 +127,12 @@ public final class Netty4Client implements NettyClient {
             if (group != null && !group.isShutdown()) {
                 group.shutdownGracefully(0, SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS);
                 try {
+                    if (eventLoop != null && eventLoop.inEventLoop()) {
+                        // If scripted close we might be inside the event loop and
+                        // we cannot wait in that case.
+                        return;
+                    }
+
                     if (!group.awaitTermination(2 * SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS)) {
                         LOG.trace("Connection IO Event Loop shutdown failed to complete in allotted time");
                     }
diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty5/Netty5Client.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty5/Netty5Client.java
index a9d3e16a..643374c8 100644
--- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty5/Netty5Client.java
+++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/netty/netty5/Netty5Client.java
@@ -126,6 +126,12 @@ public final class Netty5Client implements NettyClient {
             if (group != null && !group.isShutdown()) {
                 group.shutdownGracefully(0, SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS);
                 try {
+                    if (eventLoop != null && eventLoop.inEventLoop()) {
+                        // If scripted close we might be inside the event loop and
+                        // we cannot wait in that case.
+                        return;
+                    }
+
                     if (!group.awaitTermination(2 * SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS)) {
                         LOG.trace("Connection IO Event Loop shutdown failed to complete in allotted time");
                     }


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