|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--uk.ac.ebi.intact.application.editor.util.LockManager
The lock manager keeps a track of edit objects. It uses the AC as a unique identifier for edit objects. Only a single instance of this class is used by multiple users. This class is thread safe.
| Nested Class Summary | |
class |
LockManager.LockObject
|
| Method Summary | |
boolean |
acquire(java.lang.String id,
java.lang.String owner)
Obtains a lock. |
static LockManager |
getInstance()
|
LockManager.LockObject |
getLock(java.lang.String id)
Returns the lock object for given id if it exists. |
java.util.List |
getLocks()
Returns a clone of the current locks. |
java.lang.String |
getOwner(java.lang.String id)
Returns the owner for given id if it exists. |
boolean |
hasLock(java.lang.String ac)
Checks the existence of given lock. |
void |
release(java.lang.String id)
Removes given lock. |
void |
releaseAllLocks(java.lang.String owner)
Release all the locks held by given owner. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static LockManager getInstance()
public boolean hasLock(java.lang.String ac)
ac - the id to check for the lock
ac; false is returned for
all other instances.public LockManager.LockObject getLock(java.lang.String id)
id - the of the lock.
id if a lock exists for it. Null
is returned if there is no lock object.public java.lang.String getOwner(java.lang.String id)
id - the of the lock.
id if there is an owner or an empty
street is returned.
public boolean acquire(java.lang.String id,
java.lang.String owner)
id - the id to obtain the lock for.owner - the onwer of the lock.
public void release(java.lang.String id)
id - the id for the lock.public void releaseAllLocks(java.lang.String owner)
owner - the owner to release the locks for.public java.util.List getLocks()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||