|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.LockManager
public class LockManager
provides methods for persistent locks on DBEntry objects.
This class requires a proper store capable of handling LockEntry objects
(including a working DBClassStore.generateNewID() method).
Generally, reference may be locked even though the do not exist in the database.
| Constructor Summary | |
|---|---|
LockManager(DBClassStore<LockEntry> store)
|
|
| Method Summary | |
|---|---|
boolean |
forceUnlock(DBReference ref,
long lockTime)
if you don't have the token, you may first obtain the LockInfo and then use its time to release the given lock |
int |
forceUnlockForAll(long anyLockAquiredBeforeThisTime)
|
String |
generateToken()
|
Filter<LockEntry> |
getFilterFor(DBReference ref)
this may want to be overridden to be more efficient based on the mapping in use |
LockInfo |
getLockInfo(DBReference ref)
|
DBClassStore<LockEntry> |
getStore()
|
TimeSystem |
getTimeSystem()
|
boolean |
isLocked(DBReference ref)
|
boolean |
isLockedWithToken(DBReference ref,
String token)
|
String |
lock(DBReference ref,
String who,
String where,
String why)
|
boolean |
release(DBReference ref,
String token)
|
void |
setTimeSystem(TimeSystem ts)
|
void |
setWriteLockTask(Task<Exception> task)
|
boolean |
unlock(DBReference ref,
String token)
|
DBClassStore<LockEntry> |
unwrap()
returns the embedded instance that this wrapper encloses |
void |
writeLock()
provides a way to put a write lock on the associated data from the store so that we can avoid deadlocks |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LockManager(DBClassStore<LockEntry> store)
| Method Detail |
|---|
public DBClassStore<LockEntry> getStore()
public DBClassStore<LockEntry> unwrap()
Wrapped
unwrap in interface Wrapped<DBClassStore<LockEntry>>
public boolean isLocked(DBReference ref)
throws DatabaseException
DatabaseException
public boolean isLockedWithToken(DBReference ref,
String token)
throws DatabaseException
DatabaseException
public LockInfo getLockInfo(DBReference ref)
throws DatabaseException
DatabaseException
public void writeLock()
throws Exception
ExceptionsetWriteLockTask(Task)public void setWriteLockTask(Task<Exception> task)
writeLock()
public String lock(DBReference ref,
String who,
String where,
String why)
throws DatabaseException,
NotApplicableDataWarning
DatabaseException
NotApplicableDataWarning
public boolean unlock(DBReference ref,
String token)
throws NotApplicableDataWarning,
DatabaseException
NotApplicableDataWarning
DatabaseExceptionrelease(DBReference, String)
public boolean release(DBReference ref,
String token)
throws NotApplicableDataWarning,
DatabaseException
NotApplicableDataWarning
DatabaseException
public boolean forceUnlock(DBReference ref,
long lockTime)
throws DatabaseException
DatabaseException
@Warning(value="goes through all entries and deletes all those that qualify; use w/ caution!")
public int forceUnlockForAll(long anyLockAquiredBeforeThisTime)
throws DatabaseException
DatabaseExceptionpublic TimeSystem getTimeSystem()
public void setTimeSystem(TimeSystem ts)
public String generateToken()
public Filter<LockEntry> getFilterFor(DBReference ref)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||