diff options
author | Sven Gothel <sgothel@jausoft.com> | 2014-07-03 16:06:47 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2014-07-03 16:06:47 +0200 |
commit | df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch) | |
tree | 239ae276b82024b140428e6c0fe5d739fdd686a4 /src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java | |
parent | eb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java')
-rw-r--r-- | src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java index c699e2e..775d46f 100644 --- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java +++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java @@ -60,22 +60,22 @@ public class TestSingletonServerSocket00 { @Test public void test2ndInstanceLockTimeout() { Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)); - SingletonInstance instanceTwo = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); + final SingletonInstance instanceTwo = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); Assert.assertFalse("Could lock 2nd instance: "+instanceTwo.getName(), instanceTwo.tryLock(1000)); // 10x System.gc(); // force cleanup singletonInstance.unlock(); } - private Thread startLockUnlockOffThread(int i) { + private Thread startLockUnlockOffThread(final int i) { final Thread t = new Thread(new Runnable() { public void run() { - SingletonInstance myLock = SingletonInstance.createServerSocket(10, SINGLE_INSTANCE_LOCK_PORT); + final SingletonInstance myLock = SingletonInstance.createServerSocket(10, SINGLE_INSTANCE_LOCK_PORT); System.err.println(Thread.currentThread().getName()+" LOCK try .."); Assert.assertTrue(Thread.currentThread().getName()+" - Could not lock instance: "+myLock.getName(), myLock.tryLock(1000)); System.err.println(Thread.currentThread().getName()+" LOCK ON"); try { Thread.sleep(300); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } myLock.unlock(); System.err.println(Thread.currentThread().getName()+" LOCK OFF"); } @@ -87,8 +87,8 @@ public class TestSingletonServerSocket00 { @Test public void testOffthreadLockUnlock() throws InterruptedException { Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)); - Thread t1 = startLockUnlockOffThread(1); - Thread t2 = startLockUnlockOffThread(2); + final Thread t1 = startLockUnlockOffThread(1); + final Thread t2 = startLockUnlockOffThread(2); Thread.sleep(300); System.gc(); // force cleanup singletonInstance.unlock(); @@ -97,8 +97,8 @@ public class TestSingletonServerSocket00 { } } - public static void main(String args[]) throws IOException, InterruptedException { - String tstname = TestSingletonServerSocket00.class.getName(); + public static void main(final String args[]) throws IOException, InterruptedException { + final String tstname = TestSingletonServerSocket00.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } |