Top Fields Constructors Methods
jogamp.common.util.locks

public Class RecursiveLockImplJava5

extends Object
implements RecursiveLock
Class Inheritance
All Implemented Interfaces
com.jogamp.common.util.locks.RecursiveLock, com.jogamp.common.util.locks.ThreadLock, com.jogamp.common.util.locks.Lock
Imports
java.util.concurrent.TimeUnit, java.util.concurrent.locks.ReentrantLock, com.jogamp.common.util.locks.RecursiveLock

Field Summary

Modifier and TypeField and Description
pack-priv ReentrantLock
pack-priv volatile Thread

Constructor Summary

AccessConstructor and Description
public
RecursiveLockImplJava5(final boolean fair)

Method Summary

Modifier and TypeMethod and Description
public int
getHoldCount()

Implements com.jogamp.common.util.locks.RecursiveLock.getHoldCount.

Return the number of locks issued to this lock by the same thread.
public Thread
public int
public boolean
public boolean
isLockedByOtherThread()

Implements com.jogamp.common.util.locks.ThreadLock.isLockedByOtherThread.

Query whether the lock is hold by the a thread other than the current thread.
public boolean
isOwner(final Thread thread)

Implements com.jogamp.common.util.locks.ThreadLock.isOwner.

Query whether the lock is hold by the given thread.
public void
lock()

Implements com.jogamp.common.util.locks.Lock.lock.

Blocking until the lock is acquired by this Thread or TIMEOUT is reached.
private String
threadName(final Thread t)

public boolean
tryLock(final long
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.
timeout
)

Implements com.jogamp.common.util.locks.Lock.tryLock.

Blocking until the lock is acquired by this Thread or maxwait in ms is reached.
public void
unlock()

Implements com.jogamp.common.util.locks.Lock.unlock.

Release the lock.
public void
unlock(final Runnable taskAfterUnlockBeforeNotify)

Implements com.jogamp.common.util.locks.ThreadLock.unlock.

Execute the Runnable taskAfterUnlockBeforeNotify while holding the exclusive lock.
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lockback to summary
pack-priv ReentrantLock lock
ownerback to summary
pack-priv volatile Thread owner

Constructor Detail

RecursiveLockImplJava5back to summary
public RecursiveLockImplJava5(final boolean fair)

Method Detail

getHoldCountback to summary
public int getHoldCount()

Implements com.jogamp.common.util.locks.RecursiveLock.getHoldCount.

Doc from com.jogamp.common.util.locks.RecursiveLock.getHoldCount.

Return the number of locks issued to this lock by the same thread.

  • A hold count of 0 identifies this lock as unlocked.
  • A hold count of 1 identifies this lock as locked.
  • A hold count of > 1 identifies this lock as recursively lock.
Annotations
@Override
getOwnerback to summary
public Thread getOwner()

Implements com.jogamp.common.util.locks.ThreadLock.getOwner.

Returns:Thread

Doc from com.jogamp.common.util.locks.ThreadLock.getOwner.

the Thread owning this lock if locked, otherwise null

Annotations
@Override
getQueueLengthback to summary
public int getQueueLength()

Implements com.jogamp.common.util.locks.RecursiveLock.getQueueLength.

Annotations
@Override
isLockedback to summary
public boolean isLocked()

Implements com.jogamp.common.util.locks.Lock.isLocked.

Doc from com.jogamp.common.util.locks.Lock.isLocked.

Query if locked

Annotations
@Override
isLockedByOtherThreadback to summary
public boolean isLockedByOtherThread()

Implements com.jogamp.common.util.locks.ThreadLock.isLockedByOtherThread.

Doc from com.jogamp.common.util.locks.ThreadLock.isLockedByOtherThread.

Query whether the lock is hold by the a thread other than the current thread.

Annotations
@Override
isOwnerback to summary
public boolean isOwner(final Thread thread)

Implements com.jogamp.common.util.locks.ThreadLock.isOwner.

Doc from com.jogamp.common.util.locks.ThreadLock.isOwner.

Query whether the lock is hold by the given thread.

Annotations
@Override
lockback to summary
public void lock()

Implements com.jogamp.common.util.locks.Lock.lock.

Doc from com.jogamp.common.util.locks.Lock.lock.

Blocking until the lock is acquired by this Thread or TIMEOUT is reached.

Annotations
@Override
threadNameback to summary
private String threadName(final Thread t)
tryLockback to summary
public boolean tryLock(final long timeout) throws InterruptedException

Implements com.jogamp.common.util.locks.Lock.tryLock.

Doc from com.jogamp.common.util.locks.Lock.tryLock.

Blocking until the lock is acquired by this Thread or maxwait in ms is reached.

Parameters
timeout:long

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:boolean

true if the lock has been acquired within maxwait, otherwise false

Annotations
@Override
unlockback to summary
public void unlock() throws RuntimeException

Implements com.jogamp.common.util.locks.Lock.unlock.

Doc from com.jogamp.common.util.locks.Lock.unlock.

Release the lock.

Annotations
@Override
Exceptions
RuntimeException:
in case the lock is not acquired by this thread.
unlockback to summary
public void unlock(final Runnable taskAfterUnlockBeforeNotify)

Implements com.jogamp.common.util.locks.ThreadLock.unlock.

Doc from com.jogamp.common.util.locks.ThreadLock.unlock.

Execute the Runnable taskAfterUnlockBeforeNotify while holding the exclusive lock.

Then release the lock.

Annotations
@Override
validateLockedback to summary
public void validateLocked() throws RuntimeException

Implements com.jogamp.common.util.locks.ThreadLock.validateLocked.

Annotations
@Override
Exceptions
RuntimeException:

Doc from com.jogamp.common.util.locks.ThreadLock.validateLocked.

if current thread does not hold the lock