public class ResourceLocks extends Object implements IResourceLocks
| Modifier and Type | Field and Description |
|---|---|
protected int |
cleanupCounter |
protected Hashtable<String,LockedObject> |
locks
keys: path value: LockedObject from that path
|
protected Hashtable<String,LockedObject> |
locksByID
keys: id value: LockedObject from that id
|
protected LockedObject |
root |
protected Hashtable<String,LockedObject> |
tempLocks
keys: path value: Temporary LockedObject from that path
|
protected Hashtable<String,LockedObject> |
tempLocksByID
keys: id value: Temporary LockedObject from that id
|
protected LockedObject |
tempRoot |
| Constructor and Description |
|---|
ResourceLocks() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkTimeouts(ITransaction transaction,
boolean temporary)
Deletes LockedObjects, where timeout has reached.
|
boolean |
exclusiveLock(ITransaction transaction,
String path,
String owner,
int depth,
int timeout)
Tries to lock the resource at "path" exclusively.
|
LockedObject |
getLockedObjectByID(ITransaction transaction,
String id)
Gets the LockedObject corresponding to specified id.
|
LockedObject |
getLockedObjectByPath(ITransaction transaction,
String path)
Gets the LockedObject on specified path.
|
LockedObject |
getTempLockedObjectByID(ITransaction transaction,
String id)
Gets the LockedObject corresponding to specified id (locktoken).
|
LockedObject |
getTempLockedObjectByPath(ITransaction transaction,
String path)
Gets the LockedObject on specified path.
|
boolean |
lock(ITransaction transaction,
String path,
String owner,
boolean exclusive,
int depth,
int timeout,
boolean temporary)
Tries to lock the resource at "path".
|
boolean |
sharedLock(ITransaction transaction,
String path,
String owner,
int depth,
int timeout)
Tries to lock the resource at "path" shared.
|
boolean |
unlock(ITransaction transaction,
String id,
String owner)
Unlocks all resources at "path" (and all subfolders if existing)
that have the same owner.
|
void |
unlockTemporaryLockedObjects(ITransaction transaction,
String path,
String owner)
Unlocks all resources at "path" (and all subfolders if existing)
that have the same owner.
|
protected int cleanupCounter
protected Hashtable<String,LockedObject> locks
protected Hashtable<String,LockedObject> locksByID
protected Hashtable<String,LockedObject> tempLocks
protected Hashtable<String,LockedObject> tempLocksByID
protected LockedObject root
protected LockedObject tempRoot
public boolean lock(ITransaction transaction, String path, String owner, boolean exclusive, int depth, int timeout, boolean temporary) throws LockFailedException
IResourceLockslock in interface IResourceLockspath - what resource to lockowner - the owner of the lockexclusive - if the lock should be exclusive (or shared)depth - depthtimeout - Lock Duration in seconds.LockFailedExceptionpublic boolean unlock(ITransaction transaction, String id, String owner)
IResourceLocksunlock in interface IResourceLocksid - id to the resource to unlockowner - who wants to unlockpublic void unlockTemporaryLockedObjects(ITransaction transaction, String path, String owner)
IResourceLocksunlockTemporaryLockedObjects in interface IResourceLockspath - what resource to unlockowner - who wants to unlockpublic void checkTimeouts(ITransaction transaction, boolean temporary)
IResourceLockscheckTimeouts in interface IResourceLockstemporary - Check timeout on temporary or real lockspublic boolean exclusiveLock(ITransaction transaction, String path, String owner, int depth, int timeout) throws LockFailedException
IResourceLocksexclusiveLock in interface IResourceLockstransaction - Transactionpath - what resource to lockowner - the owner of the lockdepth - depthtimeout - Lock Duration in seconds.LockFailedExceptionpublic boolean sharedLock(ITransaction transaction, String path, String owner, int depth, int timeout) throws LockFailedException
IResourceLockssharedLock in interface IResourceLockstransaction - Transactionpath - what resource to lockowner - the owner of the lockdepth - depthtimeout - Lock Duration in seconds.LockFailedExceptionpublic LockedObject getLockedObjectByID(ITransaction transaction, String id)
IResourceLocksgetLockedObjectByID in interface IResourceLocksid - LockToken to requested resourcepublic LockedObject getLockedObjectByPath(ITransaction transaction, String path)
IResourceLocksgetLockedObjectByPath in interface IResourceLockspath - Path to requested resourcepublic LockedObject getTempLockedObjectByID(ITransaction transaction, String id)
IResourceLocksgetTempLockedObjectByID in interface IResourceLocksid - LockToken to requested resourcepublic LockedObject getTempLockedObjectByPath(ITransaction transaction, String path)
IResourceLocksgetTempLockedObjectByPath in interface IResourceLockspath - Path to requested resourceCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.