PropertySetCallback
AbstractPool
, ConcurrentPool
public interface LockFactory extends PropertySetCallback
Modifier and Type | Method | Description |
---|---|---|
boolean |
anyoneBlocked() |
Returns true if locks held by anyone are blocking anyone else
|
boolean |
areLocksHeld(CompatibilitySpace compatibilitySpace) |
Return true if locks are held in this compatibility space.
|
boolean |
areLocksHeld(CompatibilitySpace compatibilitySpace,
java.lang.Object group) |
Return true if locks are held in this compatibility space and
this group.
|
void |
clearLimit(CompatibilitySpace compatibilitySpace,
java.lang.Object group) |
Clear a limit set by setLimit.
|
CompatibilitySpace |
createCompatibilitySpace(LockOwner owner) |
Create an object which can be used as a compatibility space.
|
int |
getWaitTimeout() |
Get the lock timeout in milliseconds.
|
boolean |
isLockHeld(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier) |
Check to see if a specific lock is held.
|
boolean |
lockObject(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier,
int timeout) |
Lock an object within a compatibility 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(CompatibilitySpace compatibilitySpace,
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(CompatibilitySpace compatibilitySpace,
java.lang.Object oldGroup,
java.lang.Object newGroup) |
Transfer a set of locks from one group to another.
|
int |
unlock(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier) |
Unlock a single lock on a single object held within this compatibility
space and locked with the supplied qualifier.
|
void |
unlockGroup(CompatibilitySpace compatibilitySpace,
java.lang.Object group) |
Unlock all locks in a group.
|
void |
unlockGroup(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Matchable key) |
Unlock all locks on a group that match the passed in value.
|
boolean |
zeroDurationlockObject(CompatibilitySpace compatibilitySpace,
Lockable ref,
java.lang.Object qualifier,
int timeout) |
Lock an object with zero duration within a compatibility space,
waits up to timeout milli-seconds for the object to become unlocked.
|
apply, init, map, validate
CompatibilitySpace createCompatibilitySpace(LockOwner owner)
LockFactory
that created it.owner
- the owner of the compatibility space (typically a
transaction object). Might be null
.boolean lockObject(CompatibilitySpace compatibilitySpace, 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
compatible and granted by the lock manager if the trio
{compatibilitySpace, ref, qualifier} are equal (i.e. reference equality
for qualifier and compatibilitySpace, equals() method for ref).
Granted by the lock manager means that the Lockable object may or may
not be queried to see if the request is compatible.
A compatibility space is not assumed to be owned by a single thread.
compatibilitySpace
- object defining compatibility spacegroup
- 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
- if a deadlock has occurred (message id
will be LockFactory.Deadlock), or if the wait for the lock timed
out (message id will be LockFactory.TimeOut), or if another thread
interrupted this thread while it was waiting for the lock (this will
be a StandardException with a nested InterruptedException, and the
message id will be LockFactory.InterruptedExceptionId), or if
any other error occurs when locking the objectint unlock(CompatibilitySpace compatibilitySpace, java.lang.Object group, Lockable ref, java.lang.Object qualifier)
compatibilitySpace
- object defining compatibility spacegroup
- handle of group.ref
- Reference to object to be unlocked.qualifier
- qualifier of lock to be unlockedvoid unlockGroup(CompatibilitySpace compatibilitySpace, java.lang.Object group)
compatibilitySpace
- object defining compatibility spacegroup
- handle of group that objects were locked with.void unlockGroup(CompatibilitySpace compatibilitySpace, java.lang.Object group, Matchable key)
void transfer(CompatibilitySpace compatibilitySpace, java.lang.Object oldGroup, java.lang.Object newGroup)
boolean anyoneBlocked()
boolean areLocksHeld(CompatibilitySpace compatibilitySpace, java.lang.Object group)
group
- handle of group that objects were locked with.boolean areLocksHeld(CompatibilitySpace compatibilitySpace)
boolean zeroDurationlockObject(CompatibilitySpace compatibilitySpace, 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
compatible and granted by the lock manager if the trio
{compatibilitySpace, ref, qualifier} are equal (i.e. reference equality
for qualifier and compatibilitySpace, equals() method for ref).
Granted by the lock manager means that the Lockable object may or may
not be queried to see if the request is compatible.
A compatibility space is not assumed to be owned by a single thread.
compatibilitySpace
- object defining compatibility spaceref
- 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
- if a deadlock has occurred (message id
will be LockFactory.Deadlock), or if the wait for the lock timed
out (message id will be LockFactory.TimeOut), or if another thread
interrupted this thread while it was waiting for the lock (this will
be a StandardException with a nested InterruptedException, and the
message id will be LockFactory.InterruptedExceptionId), or if
any other error occurs when locking the objectboolean isLockHeld(CompatibilitySpace compatibilitySpace, java.lang.Object group, Lockable ref, java.lang.Object qualifier)
int getWaitTimeout()
void setLimit(CompatibilitySpace compatibilitySpace, java.lang.Object group, int limit, Limit callback)
Limit
void clearLimit(CompatibilitySpace compatibilitySpace, java.lang.Object group)
java.util.Enumeration makeVirtualLockTable()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.