|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.ganymede.DBLockSync
This class acts as a general synchronization object for interlock coordination. All global data required for coordinating lock activity is stored here.
| Field Summary | |
private java.util.Hashtable |
lockHash
Identifier keys for current DBLocks. |
private int |
locksHeld
A count of how many DBLocks are
established on DBObjectBases
in this DBStore. |
| Constructor Summary | |
DBLockSync()
|
|
| Method Summary | |
void |
addLock()
Increments the count of held locks for the admin consoles. |
void |
addReadLock(java.lang.Object key,
arlut.csd.ganymede.DBReadLock lock)
This method associates a new DBReadLock with the given key, if possible. |
void |
clearLockHeld(java.lang.Object key)
This method clears out a lock associated with the given key. |
void |
delReadLock(java.lang.Object key,
arlut.csd.ganymede.DBReadLock lock)
This method disassociates a DBReadLock from the given key, if possible. |
int |
getLockCount()
Returns the number of locks presently held in the database. |
arlut.csd.ganymede.DBLock |
getLockHeld(java.lang.Object key)
This method returns a DBLock associated with the given key, if any. |
java.util.Vector |
getReadLockVector(java.lang.Object key)
This method returns a Vector of DBReadLock objects associated with key, if any. |
boolean |
isDumpLock(java.lang.Object key)
This method returns true if the lock associated with key in the DBLockSync lockHash is a DBDumpLock. |
boolean |
isLockHeld(java.lang.Object key)
This method returns true if there is a lock held in care of the given identifier in this DBLockSync object. |
boolean |
isReadLock(java.lang.Object key)
This method returns true if the lock associated with key in the DBLockSync lockHash is a DBReadLock. |
boolean |
isWriteLock(java.lang.Object key)
This method returns true if the lock associated with key in the DBLockSync lockHash is a DBWriteLock. |
void |
removeLock()
Decrements the count of held locks for the admin consoles. |
void |
resetLockHash(int count)
This method causes the DBLockSync object's lock owner hashtable to be reset. |
void |
setDumpLockHeld(java.lang.Object key,
arlut.csd.ganymede.DBDumpLock lock)
This method associates a dump lock with the given key. |
void |
setWriteLockHeld(java.lang.Object key,
arlut.csd.ganymede.DBWriteLock lock)
This method associates a write lock with the given key. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.util.Hashtable lockHash
Identifier keys for current DBLocks.
This hash is used by the establish() method in various DBLock subclasses to guarantee that only one lock will established by a client at a time, to prevent any possibility of DBLock deadlock.
The values in this hash may either be scalar DBLock objects, or in the case of readers (where it is permissible for a single client to have several distinct reader locks), a Vector of DBLocks.
private int locksHeld
DBLocks are
established on DBObjectBases
in this DBStore.
| Constructor Detail |
public DBLockSync()
| Method Detail |
public void resetLockHash(int count)
This method causes the DBLockSync object's lock owner hashtable to be reset. If count is not zero, that value will be used to set the initial capacity for the hashtable.
public boolean isLockHeld(java.lang.Object key)
This method returns true if there is a lock held in care of the given identifier in this DBLockSync object.
public boolean isReadLock(java.lang.Object key)
This method returns true if the lock associated with key in the DBLockSync lockHash is a DBReadLock.
If there is no lock associated with the key, or if the lock associated with the key is not a read lock, false will be returned.
public boolean isDumpLock(java.lang.Object key)
This method returns true if the lock associated with key in the DBLockSync lockHash is a DBDumpLock.
If there is no lock associated with the key, or if the lock associated with the key is not a dump lock, false will be returned.
public boolean isWriteLock(java.lang.Object key)
This method returns true if the lock associated with key in the DBLockSync lockHash is a DBWriteLock.
If there is no lock associated with the key, or if the lock associated with the key is not a write lock, false will be returned.
public void setWriteLockHeld(java.lang.Object key,
arlut.csd.ganymede.DBWriteLock lock)
This method associates a write lock with the given key.
public void setDumpLockHeld(java.lang.Object key,
arlut.csd.ganymede.DBDumpLock lock)
This method associates a dump lock with the given key.
public void addReadLock(java.lang.Object key,
arlut.csd.ganymede.DBReadLock lock)
This method associates a new DBReadLock with the given key, if possible. Multiple read locks may be associated with a single key in DBLockSync, but not if there is a write lock or dump lock associated with the key.
If there is already a dump or write lock associated with the key, an IllegalStateException will be thrown.
public void delReadLock(java.lang.Object key,
arlut.csd.ganymede.DBReadLock lock)
This method disassociates a DBReadLock from the given key, if possible.
If there are no read locks associated with the given key, an IllegalStateException will be thrown.
public java.util.Vector getReadLockVector(java.lang.Object key)
This method returns a Vector of DBReadLock objects associated with key, if any. If there is no DBReadLock vector associated with the key, an IllegalStateException will be thrown.
The Vector returned is part of DBLockSync's internal data structures, and should only be browsed in a block synchronized on this DBLockSync object.
The Vector returned should not be modified by external code.
public arlut.csd.ganymede.DBLock getLockHeld(java.lang.Object key)
This method returns a DBLock associated with the given key, if any.
This method will only ever return a DBWriteLock or a DBDumpLock. If the key is associated with a Vector of DBReadLocks, null will be returned.
public void clearLockHeld(java.lang.Object key)
This method clears out a lock associated with the given key.
public void addLock()
Increments the count of held locks for the admin consoles.
public void removeLock()
Decrements the count of held locks for the admin consoles.
public int getLockCount()
Returns the number of locks presently held in the database.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||