org.apache.slide.store.tlock
Class TLock
java.lang.Object
org.apache.slide.store.tlock.TLock
- public class TLock
- extends java.lang.Object
Transient locking which persists until commit/rollback. ResourceLock is a shared lock (aka
'ReadWriteLock'), it permits any number of readers as long as there is no writer.
Writer have exclusive access. Acquired before an aspect of a given ResourceId is accessed.
Released once during commit or abort. ResourceLock is a helper class for LockManager - nobody
else should know about it.
- Version:
- $Revision: 1.1.2.1 $
- Author:
- michael.hartmeier@softwareag.com, peter.nevermann@softwareag.com
Constructor Summary |
TLock(java.lang.Object sync,
long timeout,
ResourceId resourceId)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NO_LOCK
public static final int NO_LOCK
- See Also:
- Constant Field Values
READ_LOCK
public static final int READ_LOCK
- See Also:
- Constant Field Values
WRITE_LOCK
public static final int WRITE_LOCK
- See Also:
- Constant Field Values
TLock
public TLock(java.lang.Object sync,
long timeout,
ResourceId resourceId)
getActiveWriter
public java.lang.Thread getActiveWriter()
getResourceId
public ResourceId getResourceId()
acquire
public int acquire(int type)
throws TLockedException
- Obtains read or write lock for the current thread.
The lock will persist til end of transaction.
- Returns:
- current thread's lock type previously hold by current thread
- Throws:
TLockedException
getType
public int getType()
getType
public int getType(java.lang.Thread current)
release
public int release()
- Returns:
- current thread's lock type that has been released by this method.
isLocked
public boolean isLocked()
- Returns:
- true if there is any thread with lock type != NO_LOCK
toString
public java.lang.String toString()