|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> services >> [ locks overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.services.locks
Class SinglePool

java.lang.Objectjava.util.Dictionary
java.util.Hashtable
org.apache.derby.impl.services.locks.SinglePool
- All Implemented Interfaces:
- java.lang.Cloneable, org.apache.derby.iapi.services.locks.LockFactory, java.util.Map, org.apache.derby.iapi.services.property.PropertySetCallback, java.io.Serializable
- public class SinglePool
- extends java.util.Hashtable
- implements org.apache.derby.iapi.services.locks.LockFactory
- extends java.util.Hashtable
An implementation of LockFactory that uses a single pool for the locks, i.e. all lock requests go through a single point of synchronisation.
The default concrete class "SinglePool.java", prints nothing and thus
incurs no overhead associated with the code to dump lock information. An
alternate concrete class "LockDebug/TracingSinglePool.java", attempts to
output only lock information that "makes sense" to a user - for instance it
doesn't print latch locks.
MT - Mutable - Container Object : Thread Aware
| Nested Class Summary |
| Nested classes inherited from class java.util.Hashtable |
|
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary | |
(package private) int |
deadlockMonitor
True if all deadlocks errors should be logged. |
protected LockSet |
lockTable
The complete set of locks in the system MT - immutable - content dynamic : LockSet is ThreadSafe |
| Fields inherited from class java.util.Hashtable |
|
| Constructor Summary | |
SinglePool()
|
|
| Method Summary | |
boolean |
anyoneBlocked()
Returns true if locks by anyone are blocking anyone else |
org.apache.derby.iapi.services.daemon.Serviceable |
apply(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Apply a property change. |
boolean |
areLocksHeld(java.lang.Object compatabilitySpace)
Return true if locks are held in this space MT - thread safe |
boolean |
areLocksHeld(java.lang.Object compatabilitySpace,
java.lang.Object group)
Return true if locks are held in this group and this space. |
void |
clearLimit(java.lang.Object compatabilitySpace,
java.lang.Object group)
Clear a limit set by setLimit. |
private void |
getAndApply(boolean dbOnly,
java.util.Dictionary p,
java.lang.String key)
|
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(java.lang.Object compatabilitySpace,
java.lang.Object group,
org.apache.derby.iapi.services.locks.Lockable ref,
java.lang.Object qualifier)
Check to see if a specific lock is held. |
boolean |
latchObject(java.lang.Object compatabilitySpace,
org.apache.derby.iapi.services.locks.Lockable ref,
java.lang.Object qualifier,
int timeout)
Latch a specific object with a timeout. |
protected Lock |
lockAnObject(java.lang.Object compatabilitySpace,
java.lang.Object group,
org.apache.derby.iapi.services.locks.Lockable ref,
java.lang.Object qualifier,
int timeout,
org.apache.derby.iapi.services.locks.Latch heldLatch)
Lock a specific object with a timeout. |
boolean |
lockObject(java.lang.Object group,
org.apache.derby.iapi.services.locks.Lockable ref,
java.lang.Object qualifier,
int timeout,
org.apache.derby.iapi.services.locks.Latch latch)
Lock a specific object while holding a latch MT - thread safe |
boolean |
lockObject(java.lang.Object compatabilitySpace,
java.lang.Object group,
org.apache.derby.iapi.services.locks.Lockable ref,
java.lang.Object qualifier,
int timeout)
Lock a specific object MT - thread safe |
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. |
void |
setLimit(java.lang.Object compatabilitySpace,
java.lang.Object group,
int limit,
org.apache.derby.iapi.services.locks.Limit callback)
Install a limit that is called when the size of the group exceeds the required limit. |
java.lang.String |
toDebugString()
|
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(org.apache.derby.iapi.services.locks.Latch heldLatch)
Unlatch an object. |
int |
unlock(java.lang.Object compatabilitySpace,
java.lang.Object group,
org.apache.derby.iapi.services.locks.Lockable ref,
java.lang.Object qualifier)
Unlock a specific object MT - thread safe |
void |
unlockGroup(java.lang.Object compatabilitySpace,
java.lang.Object group)
Unlock a group of objects. |
void |
unlockGroup(java.lang.Object compatabilitySpace,
java.lang.Object group,
org.apache.derby.iapi.util.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(java.lang.Object compatabilitySpace,
org.apache.derby.iapi.services.locks.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 class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
lockTable
protected final LockSet lockTable
- The complete set of locks in the system
MT - immutable - content dynamic : LockSet is ThreadSafe
deadlockMonitor
int deadlockMonitor
- True if all deadlocks errors should be logged.
| Constructor Detail |
SinglePool
public SinglePool()
| Method Detail |
latchObject
public boolean latchObject(java.lang.Object compatabilitySpace, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier, int timeout) throws org.apache.derby.iapi.error.StandardException
- Latch a specific object with a timeout.
MT - thread safe- Specified by:
latchObjectin interfaceorg.apache.derby.iapi.services.locks.LockFactory
unlatch
public void unlatch(org.apache.derby.iapi.services.locks.Latch heldLatch)
- Unlatch an object.
MT - thread safe- Specified by:
unlatchin interfaceorg.apache.derby.iapi.services.locks.LockFactory
lockAnObject
protected Lock lockAnObject(java.lang.Object compatabilitySpace, java.lang.Object group, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier, int timeout, org.apache.derby.iapi.services.locks.Latch heldLatch) throws org.apache.derby.iapi.error.StandardException
- Lock a specific object with a timeout.
MT - thread safe
lockObject
public boolean lockObject(java.lang.Object compatabilitySpace, java.lang.Object group, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier, int timeout) throws org.apache.derby.iapi.error.StandardException
- Lock a specific object
MT - thread safe- Specified by:
lockObjectin interfaceorg.apache.derby.iapi.services.locks.LockFactory
lockObject
public boolean lockObject(java.lang.Object group, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier, int timeout, org.apache.derby.iapi.services.locks.Latch latch) throws org.apache.derby.iapi.error.StandardException
- Lock a specific object while holding a latch
MT - thread safe- Specified by:
lockObjectin interfaceorg.apache.derby.iapi.services.locks.LockFactory
unlock
public int unlock(java.lang.Object compatabilitySpace, java.lang.Object group, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier)
- Unlock a specific object
MT - thread safe- Specified by:
unlockin interfaceorg.apache.derby.iapi.services.locks.LockFactory
unlockGroup
public void unlockGroup(java.lang.Object compatabilitySpace, java.lang.Object group)
- Unlock a group of objects.
MT - thread safe- Specified by:
unlockGroupin interfaceorg.apache.derby.iapi.services.locks.LockFactory
unlockGroup
public void unlockGroup(java.lang.Object compatabilitySpace, java.lang.Object group, org.apache.derby.iapi.util.Matchable key)
- Description copied from interface:
org.apache.derby.iapi.services.locks.LockFactory - Unlock all locks on a group that match the passed in value.
- Specified by:
unlockGroupin interfaceorg.apache.derby.iapi.services.locks.LockFactory
transfer
public void transfer(java.lang.Object compatabilitySpace, java.lang.Object oldGroup, java.lang.Object newGroup)
- Transfer a set of locks from one group to another.
MT - thread safe- Specified by:
transferin interfaceorg.apache.derby.iapi.services.locks.LockFactory
anyoneBlocked
public boolean anyoneBlocked()
- Returns true if locks by anyone are blocking anyone else
- Specified by:
anyoneBlockedin interfaceorg.apache.derby.iapi.services.locks.LockFactory
areLocksHeld
public boolean areLocksHeld(java.lang.Object compatabilitySpace, java.lang.Object group)
- Return true if locks are held in this group and this space.
MT - thread safe- Specified by:
areLocksHeldin interfaceorg.apache.derby.iapi.services.locks.LockFactory
areLocksHeld
public boolean areLocksHeld(java.lang.Object compatabilitySpace)
- Return true if locks are held in this space
MT - thread safe- Specified by:
areLocksHeldin interfaceorg.apache.derby.iapi.services.locks.LockFactory
zeroDurationlockObject
public boolean zeroDurationlockObject(java.lang.Object compatabilitySpace, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier, int timeout) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.locks.LockFactory - Lock an object with zero duration within a compatability space,
waits up to timeout milli-seconds for the object to become unlocked. A
timeout of 0 means do not wait for the lock to be unlocked.
Note the actual time waited is approximate.
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.- Specified by:
zeroDurationlockObjectin interfaceorg.apache.derby.iapi.services.locks.LockFactory
isLockHeld
public boolean isLockHeld(java.lang.Object compatabilitySpace, java.lang.Object group, org.apache.derby.iapi.services.locks.Lockable ref, java.lang.Object qualifier)
- Description copied from interface:
org.apache.derby.iapi.services.locks.LockFactory - Check to see if a specific lock is held.
- Specified by:
isLockHeldin interfaceorg.apache.derby.iapi.services.locks.LockFactory
setLimit
public void setLimit(java.lang.Object compatabilitySpace, java.lang.Object group, int limit, org.apache.derby.iapi.services.locks.Limit callback)
- Description copied from interface:
org.apache.derby.iapi.services.locks.LockFactory - Install a limit that is called when the size of the group exceeds
the required limit.
It is not guaranteed that the callback method (Limit.reached) is called as soon as the group size exceeds the given limit. If the callback method does not result in a decrease in the number of locks held then the lock factory implementation may delay calling the method again. E.g. with a limit of 500 and a reached() method that does nothing, may result in the call back method only being called when the group size reaches 550.
Only one limit may be in place for a group at any time.- Specified by:
setLimitin interfaceorg.apache.derby.iapi.services.locks.LockFactory
clearLimit
public void clearLimit(java.lang.Object compatabilitySpace, java.lang.Object group)
- Clear a limit set by setLimit.
- Specified by:
clearLimitin interfaceorg.apache.derby.iapi.services.locks.LockFactory
makeVirtualLockTable
public java.util.Enumeration makeVirtualLockTable()
- Routines to support lock diagnostics VTIs for the benefit of VirtualLockTable
- Specified by:
makeVirtualLockTablein interfaceorg.apache.derby.iapi.services.locks.LockFactory
toDebugString
public java.lang.String toDebugString()
init
public void init(boolean dbOnly,
java.util.Dictionary p)
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Initialize the properties for this callback.
Called when addPropertySetNotification() is called
with a non-null transaction controller.
This allows code to set read its initial property
values at boot time.
Code within an init() method should use the 3 argument PropertyUtil method getPropertyFromSet() to obtain a property's value.
- Specified by:
initin interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
getAndApply
private void getAndApply(boolean dbOnly,
java.util.Dictionary p,
java.lang.String key)
validate
public boolean validate(java.lang.String key, java.io.Serializable value, java.util.Dictionary p) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Validate a property change.
- Specified by:
validatein interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
apply
public org.apache.derby.iapi.services.daemon.Serviceable apply(java.lang.String key, java.io.Serializable value, java.util.Dictionary p) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Apply a property change. Will only be called after validate has been called
and only if validate returned true. If this method is called then the
new value is the value to be used, ie. the property is not set in the
overriding JVM system set.
- Specified by:
applyin interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
map
public java.io.Serializable map(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Map a proposed new value for a property to an official value.
Will only be called after apply() has been called.
- Specified by:
mapin interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
getWaitValue
private static int getWaitValue(java.lang.String value, int defaultValue)
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> services >> [ locks overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC