From fdf357232f5bd10862980ddba60e0e0d9fe8610a Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Thu, 23 May 2013 13:38:08 +0200 Subject: [PATCH] made "EXIT" command in locking tests log something; put UNLOCK... commands into finally clause to make it more likely that tests terminate --- .../domain/test/SmartFutureCacheDeadlockTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/SmartFutureCacheDeadlockTest.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/SmartFutureCacheDeadlockTest.java index 8587a0c1950..4cd960dd53f 100755 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/SmartFutureCacheDeadlockTest.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/SmartFutureCacheDeadlockTest.java @@ -114,10 +114,13 @@ public class SmartFutureCacheDeadlockTest { // in suspended mode, the following will trigger a re-calculation immediately, // and the locks from the readerThread will be propagated to the computing thread reader.performAndWait(Command.GET_LATEST_FROM_CACHE); - assertNotNull(computingThread); - reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer - writer.performAndWait(Command.UNLOCK_AFTER_WRITE); - assertTrue(System.currentTimeMillis()-start < 5000); // must not take longer than 5s, otherwise a locking conflict must have occurred; + try { + assertNotNull(computingThread); + } finally { + reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer + writer.performAndWait(Command.UNLOCK_AFTER_WRITE); + assertTrue(System.currentTimeMillis()-start < 5000); // must not take longer than 5s, otherwise a locking conflict must have occurred; + } // see also LockUtil.NUMBER_OF_SECONDS_TO_WAIT_FOR_LOCK } @@ -267,6 +270,7 @@ public class SmartFutureCacheDeadlockTest { } finally { running = false; } + logger.info("Took and processed command "+Command.EXIT.name()+" in thread "+Thread.currentThread().getName()); } }