Repository: qpid-jms Updated Branches: refs/heads/master 965f989d3 -> b103810ba
NO-JIRA Ensure connection not dropped until listener is set Make the consumer a zero prefetch consumer so that the flow isn't emitted until the message listener is set so the connection isn't dropped until the test is in the correct state to manage the outcome. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/b103810b Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/b103810b Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/b103810b Branch: refs/heads/master Commit: b103810babeed2cce9723d4dde5523ec7d446e9d Parents: 965f989 Author: Timothy Bish <[email protected]> Authored: Wed Jul 18 15:14:10 2018 -0400 Committer: Timothy Bish <[email protected]> Committed: Wed Jul 18 15:14:10 2018 -0400 ---------------------------------------------------------------------- .../failover/FailoverIntegrationTest.java | 35 ++++++++++---------- 1 file changed, 18 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b103810b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index 7297e81..c38ba8d 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -1174,24 +1174,24 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { originalPeer.dropAfterLastHandler(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - + final CountDownLatch sessionCloseCompleted = new CountDownLatch(1); final AtomicBoolean sessionClosedThrew = new AtomicBoolean(); Thread sessionCloseThread = new Thread(new Runnable() { - - @Override - public void run() { - try { - session.close(); - LOG.debug("Close of session returned ok"); - } catch (JMSException jmsEx) { - LOG.warn("Should not throw on session close when connection drops.", jmsEx); - sessionClosedThrew.set(true); - } finally { - sessionCloseCompleted.countDown(); - } - } - }, "Session close thread"); + + @Override + public void run() { + try { + session.close(); + LOG.debug("Close of session returned ok"); + } catch (JMSException jmsEx) { + LOG.warn("Should not throw on session close when connection drops.", jmsEx); + sessionClosedThrew.set(true); + } finally { + sessionCloseCompleted.countDown(); + } + } + }, "Session close thread"); sessionCloseThread.start(); @@ -1199,7 +1199,7 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { assertTrue("Session close should have completed by now", sessionCloseCompleted.await(3, TimeUnit.SECONDS)); assertFalse("Session close should have completed normally", sessionClosedThrew.get()); - + connection.close(); } } @@ -2637,7 +2637,8 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { finalPeer.expectReceiverAttach(notNullValue(), notNullValue(), false, true, false, false, errorCondition, errorDescription); finalPeer.expectDetach(true, false, false); - final JmsConnection connection = establishAnonymousConnecton("jms.closeLinksThatFailOnReconnect=true", originalPeer, finalPeer); + final JmsConnection connection = establishAnonymousConnecton( + "jms.prefetchPolicy.all=0&jms.closeLinksThatFailOnReconnect=true", originalPeer, finalPeer); connection.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException exception) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
