Skip to content

Commit

Permalink
QPIDJMS-552 fix testRemotelyEndSessionWithProducerCompletesAsyncSends
Browse files Browse the repository at this point in the history
  • Loading branch information
franz1981 committed Nov 2, 2021
1 parent aba2e7f commit 4f2b203
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,23 +419,15 @@ protected boolean shutdown(Throwable cause) throws JMSException {
cause = new JMSException("Session closed remotely before message transfer result was notified");
}
asyncProcessCompletion(new FailOrCompleteAsyncCompletionsTask(JmsExceptionSupport.create(cause)), true);
if (connection.getCompletionExecutorService() == null) {
getCompletionExecutor().shutdown();
}
}
if (connection.getCompletionExecutorService() != null) {
final CountDownLatch completed = new CountDownLatch(1);
try {
asyncProcessCompletion(completed::countDown, true);
completed.await(connection.getCloseTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
LOG.trace("Session close awaiting send completions was interrupted");
}
} else {
try {
getCompletionExecutor().awaitTermination(connection.getCloseTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
LOG.trace("Session close awaiting send completions was interrupted");
if (connection.getCompletionExecutorService() == null) {
getCompletionExecutor().shutdown();
}
}

Expand Down

0 comments on commit 4f2b203

Please sign in to comment.