diff options
author | Sven Gothel <[email protected]> | 2014-10-03 06:12:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-03 06:12:51 +0200 |
commit | 0d9efa74b10ea29d33ecc9c2b9f06bb2209d96ca (patch) | |
tree | 5dcf4d913ebe810f5eb885da69545b7fdd8aa9c1 /src/junit/com | |
parent | 773d96584b4edc13eb6ff689eaf891aab09aa5a4 (diff) |
SingletonJunitCase: Refine poll and release behavior
- Increase poll frequency from every 1000 ms -> 500 ms
- After releasing the lock, sleep to 6 x poll period, i.e. 3s
Diffstat (limited to 'src/junit/com')
-rw-r--r-- | src/junit/com/jogamp/junit/util/SingletonJunitCase.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/junit/com/jogamp/junit/util/SingletonJunitCase.java b/src/junit/com/jogamp/junit/util/SingletonJunitCase.java index d7eab35..2552142 100644 --- a/src/junit/com/jogamp/junit/util/SingletonJunitCase.java +++ b/src/junit/com/jogamp/junit/util/SingletonJunitCase.java @@ -41,7 +41,7 @@ public abstract class SingletonJunitCase extends JunitTracer { public static final int SINGLE_INSTANCE_LOCK_PORT = 59999; public static final long SINGLE_INSTANCE_LOCK_TO = 12*60*1000; // wait up to 12 mins - public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s + public static final long SINGLE_INSTANCE_LOCK_POLL = 500; // poll every 500 ms private static SingletonInstance singletonInstance = null; // system wide lock via port locking private static final Object singletonSync = new Object(); // classloader wide lock @@ -69,6 +69,10 @@ public abstract class SingletonJunitCase extends JunitTracer { System.gc(); // force cleanup System.err.println("++++ Test Singleton.unlock()"); singletonInstance.unlock(); + try { + // 3 s sleep, allowing other instances to pick-up socket + Thread.sleep(3 * 2 * SINGLE_INSTANCE_LOCK_POLL); + } catch (final InterruptedException e) { } } } } |