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
IResourceLocks
lock
in interface IResourceLocks
path
- what resource to lockowner
- the owner of the lockexclusive
- if the lock should be exclusive (or shared)depth
- depthtimeout
- Lock Duration in seconds.LockFailedException
public boolean unlock(ITransaction transaction, String id, String owner)
IResourceLocks
unlock
in interface IResourceLocks
id
- id to the resource to unlockowner
- who wants to unlockpublic void unlockTemporaryLockedObjects(ITransaction transaction, String path, String owner)
IResourceLocks
unlockTemporaryLockedObjects
in interface IResourceLocks
path
- what resource to unlockowner
- who wants to unlockpublic void checkTimeouts(ITransaction transaction, boolean temporary)
IResourceLocks
checkTimeouts
in interface IResourceLocks
temporary
- Check timeout on temporary or real lockspublic boolean exclusiveLock(ITransaction transaction, String path, String owner, int depth, int timeout) throws LockFailedException
IResourceLocks
exclusiveLock
in interface IResourceLocks
transaction
- Transactionpath
- what resource to lockowner
- the owner of the lockdepth
- depthtimeout
- Lock Duration in seconds.LockFailedException
public boolean sharedLock(ITransaction transaction, String path, String owner, int depth, int timeout) throws LockFailedException
IResourceLocks
sharedLock
in interface IResourceLocks
transaction
- Transactionpath
- what resource to lockowner
- the owner of the lockdepth
- depthtimeout
- Lock Duration in seconds.LockFailedException
public LockedObject getLockedObjectByID(ITransaction transaction, String id)
IResourceLocks
getLockedObjectByID
in interface IResourceLocks
id
- LockToken to requested resourcepublic LockedObject getLockedObjectByPath(ITransaction transaction, String path)
IResourceLocks
getLockedObjectByPath
in interface IResourceLocks
path
- Path to requested resourcepublic LockedObject getTempLockedObjectByID(ITransaction transaction, String id)
IResourceLocks
getTempLockedObjectByID
in interface IResourceLocks
id
- LockToken to requested resourcepublic LockedObject getTempLockedObjectByPath(ITransaction transaction, String path)
IResourceLocks
getTempLockedObjectByPath
in interface IResourceLocks
path
- Path to requested resourceCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.