diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
commit | df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch) | |
tree | 239ae276b82024b140428e6c0fe5d739fdd686a4 /src/java/jogamp/common/util/locks/RecursiveLockImplJava5.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/java/jogamp/common/util/locks/RecursiveLockImplJava5.java')
-rw-r--r-- | src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java index f3dfa42..badaa72 100644 --- a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java +++ b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java @@ -10,7 +10,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { volatile Thread owner = null; ReentrantLock lock; - public RecursiveLockImplJava5(boolean fair) { + public RecursiveLockImplJava5(final boolean fair) { lock = new ReentrantLock(fair); } @@ -20,14 +20,14 @@ public class RecursiveLockImplJava5 implements RecursiveLock { if(!tryLock(TIMEOUT)) { throw new RuntimeException("Waited "+TIMEOUT+"ms for: "+threadName(owner)+" - "+threadName(Thread.currentThread())+", with count "+getHoldCount()+", lock: "+this); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException("Interrupted", e); } owner = Thread.currentThread(); } @Override - public boolean tryLock(long timeout) throws InterruptedException { + public boolean tryLock(final long timeout) throws InterruptedException { if(lock.tryLock(timeout, TimeUnit.MILLISECONDS)) { owner = Thread.currentThread(); return true; @@ -41,7 +41,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { } @Override - public void unlock(Runnable taskAfterUnlockBeforeNotify) { + public void unlock(final Runnable taskAfterUnlockBeforeNotify) { validateLocked(); owner = null; if(null!=taskAfterUnlockBeforeNotify) { @@ -66,7 +66,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { } @Override - public boolean isOwner(Thread thread) { + public boolean isOwner(final Thread thread) { return lock.isLocked() && owner == thread; } @@ -91,5 +91,5 @@ public class RecursiveLockImplJava5 implements RecursiveLock { return lock.getQueueLength(); } - private String threadName(Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } + private String threadName(final Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } } |