|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generic locking of objects. Enables deadlock detection.
MT - Mutable - Container Object - Thread Safe
Method Summary | |
boolean |
anyoneBlocked()
Returns true if locks held by anyone are blocking anyone else |
boolean |
areLocksHeld(java.lang.Object compatabilitySpace)
Return true if locks are held in this compatability space. |
boolean |
areLocksHeld(java.lang.Object compatabilitySpace,
java.lang.Object group)
Return true if locks are held in this compatability space and this group. |
void |
clearLimit(java.lang.Object compatabilitySpace,
java.lang.Object group)
Clear a limit set by setLimit. |
boolean |
isLockHeld(java.lang.Object compatabilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier)
Check to see if a specific lock is held. |
boolean |
latchObject(java.lang.Object compatabilitySpace,
Lockable ref,
java.lang.Object qualifier,
int timeout)
Latch an object. |
boolean |
lockObject(java.lang.Object group,
Lockable ref,
java.lang.Object qualifier,
int timeout,
Latch latch)
Lock an object within a compatability space and associate the lock with a group object, In addition a held latch is passed in. |
boolean |
lockObject(java.lang.Object compatabilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier,
int timeout)
Lock an object within a compatability space and associate the lock with a group object, waits up to timeout milli-seconds for the object to become unlocked. |
java.util.Enumeration |
makeVirtualLockTable()
Make a virtual lock table for diagnostics. |
void |
setLimit(java.lang.Object compatabilitySpace,
java.lang.Object group,
int limit,
Limit callback)
Install a limit that is called when the size of the group exceeds the required limit. |
void |
transfer(java.lang.Object compatabilitySpace,
java.lang.Object oldGroup,
java.lang.Object newGroup)
Transfer a set of locks from one group to another. |
void |
unlatch(Latch heldLatch)
Unlatch an object. |
int |
unlock(java.lang.Object compatabilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier)
Unlock a single lock on a single object held within this compatability space that was locked with the supplied qualifier. |
void |
unlockGroup(java.lang.Object compatabilitySpace,
java.lang.Object group)
Unlock all locks in a group. |
void |
unlockGroup(java.lang.Object compatabilitySpace,
java.lang.Object group,
Matchable key)
Unlock all locks on a group that match the passed in value. |
boolean |
zeroDurationlockObject(java.lang.Object compatabilitySpace,
Lockable ref,
java.lang.Object qualifier,
int timeout)
Lock an object with zero duration within a compatability space, waits up to timeout milli-seconds for the object to become unlocked. |
Methods inherited from interface org.apache.derby.iapi.services.property.PropertySetCallback |
apply, init, map, validate |
Method Detail |
public boolean lockObject(java.lang.Object compatabilitySpace, java.lang.Object group, Lockable ref, java.lang.Object qualifier, int timeout) throws StandardException
A compatibility space in an space where lock requests are assumed to be
compatabile and granted by the lock manager if the trio
{compatabilitySpace, ref, qualifier} are equal (i.e. reference equality
for qualifier, equals() method
for compatabilitySpace and ref ). A typical reference to use for the compatability
space is a reference to an object representing a transaction.
Granted by the lock manager means that the Lockable object may or may
not be queried to see if the request is compatible.
A compatability space is not assumed to be owned by a single thread.
compatabilitySpace
- object defining compatability space (by value)group
- handle of group, must be private to a thread.ref
- reference to object to be lockedqualifier
- A qualification of the request.timeout
- the maximum time to wait in milliseconds, LockFactory.NO_WAIT means don't wait.
StandardException
- A deadlock has occured (message id will be LockFactory.Deadlock)
StandardException
- The wait for the lock timed out (message id will be LockFactory.TimeOut).
StandardException
- Another thread interupted this thread while
it was waiting for the lock. This will be a StandardException with a nested java.lang.InterruptedException exception,
(message id will be LockFactory.InterruptedExceptionId)
StandardException
- Standard Cloudscape error policy.public boolean lockObject(java.lang.Object group, Lockable ref, java.lang.Object qualifier, int timeout, Latch latch) throws StandardException
group
- handle of group, must be private to a compatability space.ref
- reference to object to be lockedqualifier
- A qualification of the request.timeout
- amount of time to wait, NO_WAIT is not supportedlatch
- latch to be atomically released/re-latched in a wait.
StandardException
- A deadlock has occured (message id will be LockFactory.Deadlock)
StandardException
- Another thread interupted this thread while
it was waiting for the lock. This will be a StandardException with a nested java.lang.InterruptedException exception,
(message id will be LockFactory.InterruptedExceptionId)
StandardException
- Standard Cloudscape error policy.public int unlock(java.lang.Object compatabilitySpace, java.lang.Object group, Lockable ref, java.lang.Object qualifier)
compatabilitySpace
- object defining compatability space (by value)group
- handle of group.ref
- Reference to object to be unlocked.qualifier
- qualifier of lock to be unlocked
public void unlockGroup(java.lang.Object compatabilitySpace, java.lang.Object group)
group
- handle of group that objects were locked with.public void unlockGroup(java.lang.Object compatabilitySpace, java.lang.Object group, Matchable key)
public void transfer(java.lang.Object compatabilitySpace, java.lang.Object oldGroup, java.lang.Object newGroup)
public boolean anyoneBlocked()
public boolean areLocksHeld(java.lang.Object compatabilitySpace, java.lang.Object group)
group
- handle of group that objects were locked with.public boolean areLocksHeld(java.lang.Object compatabilitySpace)
public boolean latchObject(java.lang.Object compatabilitySpace, Lockable ref, java.lang.Object qualifier, int timeout) throws StandardException
StandardException
- A deadlock has occured (message id will be LockFactory.Deadlock)
StandardException
- Another thread interupted this thread while
it was waiting for the latch. This will be a StandardException with a nested java.lang.InterruptedException exception,
(message id will be LockFactory.InterruptedExceptionId)
StandardException
- Standard Cloudscape error policy.public void unlatch(Latch heldLatch)
public boolean zeroDurationlockObject(java.lang.Object compatabilitySpace, Lockable ref, java.lang.Object qualifier, int timeout) throws StandardException
Zero duration means the lock is released as soon as it is obtained.
A compatibility space in an space where lock requests are assumed to be
compatabile and granted by the lock manager if the trio
{compatabilitySpace, ref, qualifier} are equal (i.e. reference equality
for qualifier, equals() method
for compatabilitySpace and ref ). A typical reference to use for the compatability
space is a reference to an object representing a transaction.
Granted by the lock manager means that the Lockable object may or may
not be queried to see if the request is compatible.
A compatability space is not assumed to be owned by a single thread.
compatabilitySpace
- object defining compatability space (by value)ref
- reference to object to be lockedqualifier
- A qualification of the request.timeout
- the maximum time to wait in milliseconds, LockFactory.NO_WAIT means don't wait.
StandardException
- A deadlock has occured (message id will be LockFactory.Deadlock)
StandardException
- The wait for the lock timed out (message id will be LockFactory.TimeOut).
StandardException
- Another thread interupted this thread while
it was waiting for the lock. This will be a StandardException with a nested java.lang.InterruptedException exception,
(message id will be LockFactory.InterruptedExceptionId)
StandardException
- Standard Cloudscape error policy.public boolean isLockHeld(java.lang.Object compatabilitySpace, java.lang.Object group, Lockable ref, java.lang.Object qualifier)
public void setLimit(java.lang.Object compatabilitySpace, java.lang.Object group, int limit, Limit callback)
Limit
public void clearLimit(java.lang.Object compatabilitySpace, java.lang.Object group)
public java.util.Enumeration makeVirtualLockTable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |