activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1003908 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
Date Sat, 02 Oct 2010 22:23:56 GMT
Author: tabish
Date: Sat Oct  2 22:23:55 2010
New Revision: 1003908

URL: http://svn.apache.org/viewvc?rev=1003908&view=rev
Log:
Fixing a race between the session being closed and the call to commit in the async handler
that caused some exceptions occasionally in the test run.

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java?rev=1003908&r1=1003907&r2=1003908&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
Sat Oct  2 22:23:55 2010
@@ -104,7 +104,7 @@ public class JmsSchedulerTest extends Em
         latch.await(5, TimeUnit.SECONDS);
         assertEquals(latch.getCount(), 0);
     }
-    
+
     public void testTransactedSchedule() throws Exception {
         final int COUNT = 1;
         Connection connection = createConnection();
@@ -116,12 +116,12 @@ public class JmsSchedulerTest extends Em
         final CountDownLatch latch = new CountDownLatch(COUNT);
         consumer.setMessageListener(new MessageListener() {
             public void onMessage(Message message) {
-                latch.countDown();
                 try {
                     session.commit();
                 } catch (JMSException e) {
                     e.printStackTrace();
                 }
+                latch.countDown();
             }
         });
 
@@ -176,7 +176,7 @@ public class JmsSchedulerTest extends Em
         Thread.sleep(1000);
         assertEquals(NUMBER, count.get());
     }
-    
+
     public void testScheduleRestart() throws Exception {
         // send a message
         Connection connection = createConnection();
@@ -188,16 +188,16 @@ public class JmsSchedulerTest extends Em
         message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, time);
         producer.send(message);
         producer.close();
-        
+
         //restart broker
         broker.stop();
         broker.waitUntilStopped();
-        
+
         broker = createBroker(false);
         broker.start();
         broker.waitUntilStarted();
-        
-        
+
+
         // consume the message
         connection = createConnection();
         connection.start();
@@ -217,7 +217,7 @@ public class JmsSchedulerTest extends Em
     protected BrokerService createBroker() throws Exception {
         return createBroker(true);
     }
-    
+
     protected BrokerService createBroker(boolean delete) throws Exception {
         File schedulerDirectory = new File("target/scheduler");
         if (delete) {



Mime
View raw message