aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-27 04:18:53 +0200
committerSven Gothel <[email protected]>2012-06-27 04:18:53 +0200
commit834b9e530e652b7ff7c5e222720bce3ad2b11c5f (patch)
treebac459da1a84abec07f70f74204a4e1deca1d226 /src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
parent9a71703904ebfec343fb2c7266343d37a2e4c3db (diff)
Lock Cleanup (API Change)
- LockExt -> ThreadLock - clarifying semantics (API Change) - ThreadLock: Remove isOwner(), use isOwner(Thread.currentThread) - adding @Override
Diffstat (limited to 'src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java')
-rw-r--r--src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
index 7c88400..d9bc3df 100644
--- a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
+++ b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
@@ -14,6 +14,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
lock = new ReentrantLock(fair);
}
+ @Override
public void lock() {
try {
if(!tryLock(TIMEOUT)) {
@@ -25,6 +26,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
owner = Thread.currentThread();
}
+ @Override
public boolean tryLock(long timeout) throws InterruptedException {
if(lock.tryLock(timeout, TimeUnit.MILLISECONDS)) {
owner = Thread.currentThread();
@@ -33,10 +35,12 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
return false;
}
+ @Override
public void unlock() throws RuntimeException {
unlock(null);
}
+ @Override
public void unlock(Runnable taskAfterUnlockBeforeNotify) {
validateLocked();
owner = null;
@@ -46,26 +50,27 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
lock.unlock();
}
+ @Override
public boolean isLocked() {
return lock.isLocked();
}
+ @Override
public Thread getOwner() {
return owner;
}
+ @Override
public boolean isLockedByOtherThread() {
return lock.isLocked() && !lock.isHeldByCurrentThread();
}
- public boolean isOwner() {
- return lock.isHeldByCurrentThread();
- }
-
+ @Override
public boolean isOwner(Thread thread) {
return lock.isLocked() && owner == thread;
}
+ @Override
public void validateLocked() throws RuntimeException {
if ( !lock.isHeldByCurrentThread() ) {
if ( !lock.isLocked() ) {
@@ -76,10 +81,12 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
}
}
+ @Override
public int getHoldCount() {
return lock.getHoldCount();
}
+ @Override
public int getQueueLength() {
return lock.getQueueLength();
}