https://issues.apache.org/jira/browse/AMQ-4886 - think the sync on shutdown issue is resolved and the test will no longer hang

This commit is contained in:
gtully 2014-03-20 14:13:39 +00:00
parent cbb46ea7d3
commit cb6941ee0b
2 changed files with 14 additions and 10 deletions

View File

@ -979,11 +979,18 @@ class LevelDBClient(store: LevelDBStore) {
ingorefailure(might_fail(throw new IOException("non-clean close"))) ingorefailure(might_fail(throw new IOException("non-clean close")))
} }
def stop():Unit = this.synchronized { def stop():Unit = {
if( writeExecutor!=null ) { var executorToShutdown:ExecutorService = null
writeExecutor.shutdown this synchronized {
writeExecutor.awaitTermination(60, TimeUnit.SECONDS) if (writeExecutor != null) {
writeExecutor = null executorToShutdown = writeExecutor
writeExecutor = null
}
}
if (executorToShutdown != null) {
executorToShutdown.shutdown
executorToShutdown.awaitTermination(60, TimeUnit.SECONDS)
// this blocks until all io completes.. // this blocks until all io completes..
snapshotRwLock.writeLock().lock() snapshotRwLock.writeLock().lock()

View File

@ -522,14 +522,11 @@ public class AMQ2149Test {
final long expiry = System.currentTimeMillis() + 1000 * 60 * 4; final long expiry = System.currentTimeMillis() + 1000 * 60 * 4;
while(!threads.isEmpty() && exceptions.isEmpty() && System.currentTimeMillis() < expiry) { while(!threads.isEmpty() && exceptions.isEmpty() && System.currentTimeMillis() < expiry) {
Thread sendThread = threads.firstElement(); Thread sendThread = threads.firstElement();
sendThread.join(1000*20); sendThread.join(1000*30);
if (!sendThread.isAlive()) { if (!sendThread.isAlive()) {
threads.remove(sendThread); threads.remove(sendThread);
} else { } else {
Throwable throwable = new Throwable("blocked send thread"); AutoFailTestSupport.dumpAllThreads("Send blocked");
throwable.setStackTrace(sendThread.getStackTrace());
LOG.error("Send thread blocked", throwable);
throwable.printStackTrace();
} }
} }
LOG.info("senders done..." + threads); LOG.info("senders done..." + threads);