com.jogamp.common.util.locks
Class RecursiveLock

java.lang.Object
  extended by com.jogamp.common.util.locks.RecursiveLock
All Implemented Interfaces:
Lock, LockExt

public class RecursiveLock
extends Object
implements LockExt

Reentrance locking toolkit, impl a complete fair FIFO scheduler


Field Summary
 
Fields inherited from interface com.jogamp.common.util.locks.Lock
DEBUG, DEFAULT_TIMEOUT, TIMEOUT
 
Constructor Summary
RecursiveLock()
           
 
Method Summary
 Throwable getLockedStack()
          Returns the Throwable instance generated when this lock was taken the 1st time and if Lock.DEBUG is turned on, otherwise it returns always null.
 Thread getOwner()
           
 int getRecursionCount()
           
 int getWaitingThreadQueueSize()
           
 boolean isLocked()
           
 boolean isLockedByOtherThread()
           
 boolean isOwner()
           
 boolean isOwner(Thread thread)
           
 void lock()
          Blocking until the lock is acquired by this Thread or Lock.TIMEOUT is reached.
 boolean tryLock(long maxwait)
          Blocking until the lock is acquired by this Thread or maxwait in ms is reached.
 void unlock()
          Unblocking.
 void unlock(Runnable taskAfterUnlockBeforeNotify)
           
 void validateLocked()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecursiveLock

public RecursiveLock()
Method Detail

getLockedStack

public final Throwable getLockedStack()
Returns the Throwable instance generated when this lock was taken the 1st time and if Lock.DEBUG is turned on, otherwise it returns always null.

See Also:
Lock.DEBUG

getOwner

public final Thread getOwner()
Specified by:
getOwner in interface LockExt
Returns:
the Thread owning this lock if locked, otherwise null

isOwner

public final boolean isOwner()
Specified by:
isOwner in interface LockExt

isOwner

public final boolean isOwner(Thread thread)
Specified by:
isOwner in interface LockExt

isLocked

public final boolean isLocked()
Specified by:
isLocked in interface Lock

isLockedByOtherThread

public final boolean isLockedByOtherThread()
Specified by:
isLockedByOtherThread in interface LockExt

getRecursionCount

public final int getRecursionCount()

validateLocked

public final void validateLocked()
Specified by:
validateLocked in interface LockExt

lock

public final void lock()
Description copied from interface: Lock
Blocking until the lock is acquired by this Thread or Lock.TIMEOUT is reached.

Specified by:
lock in interface Lock

tryLock

public boolean tryLock(long maxwait)
Description copied from interface: Lock
Blocking until the lock is acquired by this Thread or maxwait in ms is reached.

Specified by:
tryLock in interface Lock
Parameters:
maxwait - Maximum time in ms to wait to acquire the lock. If this value is zero, the call returns immediately either without being able to acquire the lock, or with acquiring the lock directly while ignoring any scheduling order.
Returns:
true if the lock has been acquired within maxwait, otherwise false

unlock

public final void unlock()
Description copied from interface: Lock
Unblocking.

Specified by:
unlock in interface Lock

unlock

public final void unlock(Runnable taskAfterUnlockBeforeNotify)

getWaitingThreadQueueSize

public int getWaitingThreadQueueSize()