Author: orudyy Date: Fri Jul 31 09:06:08 2015 New Revision: 1693549 URL: http://svn.apache.org/r1693549 Log: QPID-3521: Remove not needed thread dump generation in the system test and count down dispatcher blocking latch in the final block
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java?rev=1693549&r1=1693548&r2=1693549&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java Fri Jul 31 09:06:08 2015 @@ -1058,49 +1058,53 @@ public class FailoverBehaviourTest exten final CountDownLatch consumerBlocker = new CountDownLatch(1); final AtomicReference<Exception> exception = new AtomicReference<>(); final CountDownLatch messageCounter = new CountDownLatch(testMessageNumber); - _consumer.setMessageListener(new MessageListener() + try { - @Override - public void onMessage(Message message) + _consumer.setMessageListener(new MessageListener() { - if (consumerBlocker.getCount() == 1) + @Override + public void onMessage(Message message) { - try + if (consumerBlocker.getCount() == 1) { - consumerBlocker.await(); + try + { + consumerBlocker.await(); + + _LOGGER.debug("Stopping connection from dispatcher thread"); + _connection.stop(); + _LOGGER.debug("Connection stopped from dispatcher thread"); + stopFlag.countDown(); + } + catch (Exception e) + { + exception.set(e); + } + } - _LOGGER.debug("Stopping connection from dispatcher thread"); - _connection.stop(); - _LOGGER.debug("Connection stopped from dispatcher thread"); - stopFlag.countDown(); + try + { + _consumerSession.commit(); + messageCounter.countDown(); } catch (Exception e) { exception.set(e); } } + }); - try - { - _consumerSession.commit(); - messageCounter.countDown(); - } - catch (Exception e) - { - exception.set(e); - } - } - }); - - int unacknowledgedMessageNumber = getUnacknowledgedMessageNumber(testMessageNumber); + int unacknowledgedMessageNumber = getUnacknowledgedMessageNumber(testMessageNumber); - assertEquals("Unexpected number of unacknowledged messages", testMessageNumber, unacknowledgedMessageNumber); - - // stop blocking dispatcher thread - consumerBlocker.countDown(); + assertEquals("Unexpected number of unacknowledged messages", testMessageNumber, unacknowledgedMessageNumber); + } + finally + { + // stop blocking dispatcher thread + consumerBlocker.countDown(); + } boolean stopResult = stopFlag.await(2000, TimeUnit.MILLISECONDS); - _LOGGER.debug("Thread dump:" + TestUtils.dumpThreads()); assertTrue("Connection was not stopped" + (exception.get() == null ? "." : ":" + exception.get().getMessage()), stopResult); assertNull("Unexpected exception on stop :" + exception.get(), exception.get()); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org