diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala index f69cb4c25e..8f6561533a 100755 --- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala +++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala @@ -979,11 +979,18 @@ class LevelDBClient(store: LevelDBStore) { ingorefailure(might_fail(throw new IOException("non-clean close"))) } - def stop():Unit = this.synchronized { - if( writeExecutor!=null ) { - writeExecutor.shutdown - writeExecutor.awaitTermination(60, TimeUnit.SECONDS) - writeExecutor = null + def stop():Unit = { + var executorToShutdown:ExecutorService = null + this synchronized { + if (writeExecutor != null) { + executorToShutdown = writeExecutor + writeExecutor = null + } + } + + if (executorToShutdown != null) { + executorToShutdown.shutdown + executorToShutdown.awaitTermination(60, TimeUnit.SECONDS) // this blocks until all io completes.. snapshotRwLock.writeLock().lock() diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java index ee80c08c6b..b2eba61366 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java @@ -522,14 +522,11 @@ public class AMQ2149Test { final long expiry = System.currentTimeMillis() + 1000 * 60 * 4; while(!threads.isEmpty() && exceptions.isEmpty() && System.currentTimeMillis() < expiry) { Thread sendThread = threads.firstElement(); - sendThread.join(1000*20); + sendThread.join(1000*30); if (!sendThread.isAlive()) { threads.remove(sendThread); } else { - Throwable throwable = new Throwable("blocked send thread"); - throwable.setStackTrace(sendThread.getStackTrace()); - LOG.error("Send thread blocked", throwable); - throwable.printStackTrace(); + AutoFailTestSupport.dumpAllThreads("Send blocked"); } } LOG.info("senders done..." + threads);