|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.services.locks.AbstractPool
abstract class AbstractPool
An abstract implementation of LockFactory that allows different
implementations of the lock table to be plugged in. All the methods of
LockFactory are implemented. Subclasses must implement the
createLockTable() method and make it return the desired
LockTable object.
MT - Mutable - Container Object : Thread Aware
| Field Summary | |
|---|---|
(package private) int |
deadlockMonitor
True if all deadlocks errors should be logged. |
protected LockTable |
lockTable
The complete set of locks in the system MT - immutable - content dynamic : LockSet is ThreadSafe |
| Constructor Summary | |
|---|---|
protected |
AbstractPool()
|
| Method Summary | |
|---|---|
boolean |
anyoneBlocked()
Returns true if locks by anyone are blocking anyone else |
Serviceable |
apply(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Apply a property change. |
boolean |
areLocksHeld(CompatibilitySpace compatibilitySpace)
Return true if locks are held in this space MT - thread safe |
boolean |
areLocksHeld(CompatibilitySpace compatibilitySpace,
java.lang.Object group)
Return true if locks are held in this group and this space. |
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 within this lock manager. |
protected abstract LockTable |
createLockTable()
Create the lock table that contains the mapping from Lockables to locks. |
private void |
getAndApply(boolean dbOnly,
java.util.Dictionary p,
java.lang.String key)
|
int |
getWaitTimeout()
Get the lock timeout in milliseconds. |
private static int |
getWaitValue(java.lang.String value,
int defaultValue)
|
void |
init(boolean dbOnly,
java.util.Dictionary p)
Initialize the properties for this callback. |
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 a specific object with a timeout. |
java.util.Enumeration |
makeVirtualLockTable()
Routines to support lock diagnostics VTIs for the benefit of VirtualLockTable |
java.io.Serializable |
map(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Map a proposed new value for a property to an official value. |
(package private) static boolean |
noLockWait(int timeout,
CompatibilitySpace compat)
Check if we should not wait for locks, given the specified timeout and compatibility space. |
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 specific object MT - thread safe |
void |
unlockGroup(CompatibilitySpace compatibilitySpace,
java.lang.Object group)
Unlock a group of objects. |
void |
unlockGroup(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Matchable key)
Unlock all locks on a group that match the passed in value. |
boolean |
validate(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Validate a property change. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final LockTable lockTable
int deadlockMonitor
| Constructor Detail |
|---|
protected AbstractPool()
| Method Detail |
|---|
protected abstract LockTable createLockTable()
Lockables to locks.
LockTable interface
public boolean lockObject(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier,
int timeout)
throws StandardException
lockObject in interface LockFactorycompatibilitySpace - 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 - Standard Derby error policyLockFactory.lockObject(org.apache.derby.iapi.services.locks.CompatibilitySpace, java.lang.Object, org.apache.derby.iapi.services.locks.Lockable, java.lang.Object, int)public CompatibilitySpace createCompatibilitySpace(LockOwner owner)
createCompatibilitySpace in interface LockFactoryowner - the owner of the compatibility space
public int unlock(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier)
unlock in interface LockFactorycompatibilitySpace - object defining compatibility spacegroup - handle of group.ref - Reference to object to be unlocked.qualifier - qualifier of lock to be unlocked
LockFactory.unlock(org.apache.derby.iapi.services.locks.CompatibilitySpace, java.lang.Object, org.apache.derby.iapi.services.locks.Lockable, java.lang.Object)
public void unlockGroup(CompatibilitySpace compatibilitySpace,
java.lang.Object group)
unlockGroup in interface LockFactorygroup - handle of group that objects were locked with.
If group is null then this call is equivilent to unlockAll().compatibilitySpace - object defining compatibility spaceLockFactory.unlockGroup(org.apache.derby.iapi.services.locks.CompatibilitySpace, java.lang.Object)
public void unlockGroup(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Matchable key)
LockFactory
unlockGroup in interface LockFactory
public void transfer(CompatibilitySpace compatibilitySpace,
java.lang.Object oldGroup,
java.lang.Object newGroup)
transfer in interface LockFactoryLockFactory.transfer(org.apache.derby.iapi.services.locks.CompatibilitySpace, java.lang.Object, java.lang.Object)public boolean anyoneBlocked()
anyoneBlocked in interface LockFactory
public boolean areLocksHeld(CompatibilitySpace compatibilitySpace,
java.lang.Object group)
areLocksHeld in interface LockFactorygroup - handle of group that objects were locked with.LockFactory.areLocksHeld(org.apache.derby.iapi.services.locks.CompatibilitySpace, java.lang.Object)public boolean areLocksHeld(CompatibilitySpace compatibilitySpace)
areLocksHeld in interface LockFactoryLockFactory.areLocksHeld(org.apache.derby.iapi.services.locks.CompatibilitySpace, java.lang.Object)
public boolean zeroDurationlockObject(CompatibilitySpace compatibilitySpace,
Lockable ref,
java.lang.Object qualifier,
int timeout)
throws StandardException
LockFactoryZero 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.
zeroDurationlockObject in interface LockFactorycompatibilitySpace - 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 - A deadlock has occured (message id will be LockFactory.Deadlock)
public boolean isLockHeld(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
Lockable ref,
java.lang.Object qualifier)
LockFactory
isLockHeld in interface LockFactorypublic int getWaitTimeout()
getWaitTimeout in interface LockFactory
public void setLimit(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
int limit,
Limit callback)
LockFactory
setLimit in interface LockFactoryLimit
public void clearLimit(CompatibilitySpace compatibilitySpace,
java.lang.Object group)
clearLimit in interface LockFactory
static boolean noLockWait(int timeout,
CompatibilitySpace compat)
C_LockFactory.NO_WAIT or
the LockOwner has the noWait flag set, we shouldn't
wait for locks.
timeout - the specified timeoutcompat - the compatibility space
true if we shouldn't wait for locks, false
otherwisepublic java.util.Enumeration makeVirtualLockTable()
makeVirtualLockTable in interface LockFactory
public void init(boolean dbOnly,
java.util.Dictionary p)
PropertySetCallbackCode within an init() method should use the 3 argument PropertyUtil method getPropertyFromSet() to obtain a property's value.
init in interface PropertySetCallbackdbOnly - true if only per-database properties are to be looked atp - the complete set of per-database properties.
private void getAndApply(boolean dbOnly,
java.util.Dictionary p,
java.lang.String key)
public boolean validate(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
throws StandardException
PropertySetCallback
validate in interface PropertySetCallbackkey - Property key for the property being setvalue - proposed new value for the property being set or null if
the property is being dropped.p - Property set before the change. SettingProperty may read but
must never change p.
StandardException - Oh well.
public Serviceable apply(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
throws StandardException
PropertySetCallback
apply in interface PropertySetCallbackkey - Property key for the property being setvalue - proposed new value for the property being set or null if
the property is being dropped.p - Property set before the change. SettingProperty may read but
must never change p.
StandardException - Oh well.
public java.io.Serializable map(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
PropertySetCallback
map in interface PropertySetCallbackkey - Property key for the property being setvalue - proposed new value for the property being set or null if
the property is being dropped.p - Property set before the change. SettingProperty may read but
must never change p.
private static int getWaitValue(java.lang.String value,
int defaultValue)
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||