Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70021973D for ; Fri, 2 Mar 2012 11:46:55 +0000 (UTC) Received: (qmail 35376 invoked by uid 500); 2 Mar 2012 11:46:55 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 35329 invoked by uid 500); 2 Mar 2012 11:46:55 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 35322 invoked by uid 99); 2 Mar 2012 11:46:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 11:46:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 11:46:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9D87A2388980 for ; Fri, 2 Mar 2012 11:46:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120302114631.9D87A2388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); }