activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1296157 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
Date Fri, 02 Mar 2012 11:46:31 GMT
Author: gtully
Date: Fri Mar  2 11:46:31 2012
New Revision: 1296157

URL: http://svn.apache.org/viewvc?rev=1296157&view=rev
Log:
fix intermittent hang if all threads do not complete on time

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java?rev=1296157&r1=1296156&r2=1296157&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
Fri Mar  2 11:46:31 2012
@@ -254,9 +254,10 @@ public class PListTest {
         executor.execute(new B());
 
         executor.shutdown();
-        executor.awaitTermination(30, TimeUnit.SECONDS);
+        boolean finishedInTime = executor.awaitTermination(30, TimeUnit.SECONDS);
 
         assertTrue("no exceptions", exceptions.isEmpty());
+        assertTrue("finished ok", finishedInTime);
     }
 
 
@@ -287,7 +288,8 @@ public class PListTest {
         }
 
         executor.shutdown();
-        executor.awaitTermination(60*5, TimeUnit.SECONDS);
+        boolean finishedInTime = executor.awaitTermination(60*5, TimeUnit.SECONDS);
+        assertTrue("finished ok", finishedInTime);
     }
 
     @Test
@@ -369,8 +371,9 @@ public class PListTest {
 
         executor.shutdown();
         LOG.info("wait for parallel work to complete");
-        executor.awaitTermination(60*5, TimeUnit.SECONDS);
+        boolean finishedInTime = executor.awaitTermination(60*5, TimeUnit.SECONDS);
         assertTrue("no exceptions", exceptions.isEmpty());
+        assertTrue("finished ok", finishedInTime);
     }
 
     // for non determinant issues, increasing this may help diagnose
@@ -434,8 +437,8 @@ public class PListTest {
         executor.shutdown();
         LOG.info("wait for parallel work to complete");
         boolean shutdown = executor.awaitTermination(60*60, TimeUnit.SECONDS);
+        assertTrue("no exceptions: " + exceptions, exceptions.isEmpty());
         assertTrue("test did not  timeout ", shutdown);
-        assertTrue("no exceptions", exceptions.isEmpty());
     }
 
     enum TaskType {CREATE, DELETE, ADD, REMOVE, ITERATE, ITERATE_REMOVE}
@@ -570,6 +573,9 @@ public class PListTest {
 
     @After
     public void tearDown() throws Exception {
+        if (executor != null) {
+            executor.shutdownNow();
+        }
         store.stop();
         exceptions.clear();
     }



Mime
View raw message