run the session shutdown when notified or remote closure
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/f111d9dd Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/f111d9dd Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/f111d9dd Branch: refs/heads/master Commit: f111d9dd34521a2d997ea6cfd9753d8f2a613008 Parents: d855501 Author: Robert Gemmell <[email protected]> Authored: Thu Feb 26 15:04:38 2015 +0000 Committer: Robert Gemmell <[email protected]> Committed: Thu Feb 26 15:04:38 2015 +0000 ---------------------------------------------------------------------- .../main/java/org/apache/qpid/jms/JmsConnection.java | 12 ++++++++++++ .../qpid/jms/integration/SessionIntegrationTest.java | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f111d9dd/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 671cb92..90b03c9 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -1101,6 +1101,18 @@ public class JmsConnection implements Connection, TopicConnection, QueueConnecti public void onResourceRemotelyClosed(JmsResource resource, Exception cause) { if (resource.equals(this.connectionInfo)) { onException(cause); + } else if (resource instanceof JmsSessionInfo) { + JmsSession s = sessions.get(resource); + if (s != null) { + try { + // TODO: pass the exception? + s.shutdown(); + } catch (JMSException e) { + LOG.warn("Cause exception while notifying session of remote close: {}", cause, cause); + } + + // TODO: exception listener? + } } else { LOG.info("A JMS resource has been remotely closed: {}", resource); } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f111d9dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java index 4144cb9..c65b789 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java @@ -1179,7 +1179,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase { } } - @Ignore // TODO: resolve related issues and enable @Test(timeout = 5000) public void testRemotelyEndSessionWithProducer() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { @@ -1211,7 +1210,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase { } } - @Ignore // TODO: resolve related issues and enable @Test(timeout = 5000) public void testRemotelyEndSessionWithConsumer() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
