Skip to content

Commit 944ee2f

Browse files
committed
ARTEMIS-5987: Properly handling exceptions with single connection.
If there is an issue while creating a session in single connection mode then the connection factory can be in a bad state and the lopp for creating sessions still continues ove this. Issue: https://issues.apache.org/jira/browse/ARTEMIS-5987 Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
1 parent d8cd96a commit 944ee2f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,22 @@ protected synchronized void setup() throws Exception {
259259
handler.setup();
260260
handlers.add(handler);
261261
} catch (Exception e) {
262+
logger.trace("Failed to setup session {} for activation {}", i, spec, e);
262263
if (cf != null) {
263-
if (!spec.isSingleConnection()) {
264-
cf.close();
265-
}
264+
cf.close();
266265
}
267266
if (session != null) {
268267
session.close();
269268
}
270269
if (firstException == null) {
271270
firstException = e;
272271
}
272+
if (spec.isSingleConnection()) {
273+
// The shared ClientSessionFactory is in a broken state; stop the loop
274+
// all remaining sessions would fail with "ClientSession closed while
275+
// creating session", masking the real error.
276+
break;
277+
}
273278
}
274279
}
275280
//if we have any exceptions close all the handlers and throw the first exception.

0 commit comments

Comments
 (0)