public class LockedObject extends Object
Modifier and Type | Field and Description |
---|---|
protected LockedObject[] |
children
children of that lock
|
protected boolean |
exclusive
weather the lock is exclusive or not. if owner=null the exclusive value doesn't matter
|
protected long |
expiresAt
Describing the timeout of a locked object (ms)
|
protected int |
lockDepth
Describing the depth of a locked collection.
|
protected String[] |
owner
owner of the lock. shared locks can have multiple owners. is null if no owner is present
|
protected LockedObject |
parent |
protected String |
type
weather the lock is a write or read lock
|
Constructor and Description |
---|
LockedObject(ResourceLocks resLocks,
String path,
boolean temporary) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(LockedObject newChild)
adds a new child lock to this lock
|
boolean |
addLockedObjectOwner(String owner)
adds a new owner to a lock
|
boolean |
checkLocks(boolean exclusive,
int depth)
checks if a lock of the given exclusivity can be placed, only considering children up to "depth"
|
String |
getID()
Gets the LockID (locktoken) for the LockedObject
|
int |
getLockDepth()
Gets the depth of the lock
|
String[] |
getOwner()
Gets the owners for the LockedObject
|
String |
getPath()
Gets the path for the LockedObject
|
long |
getTimeoutMillis()
Gets the timeout for the LockedObject
|
String |
getType()
Gets the type of the lock
|
boolean |
hasExpired()
Return true if the lock has expired.
|
boolean |
isExclusive()
Gets the exclusivity for the LockedObject
|
boolean |
isShared()
Gets the exclusivity for the LockedObject
|
void |
refreshTimeout(int timeout)
Sets a new timeout for the LockedObject
|
void |
removeLockedObject()
deletes this Lock object. assumes that it has no children and no owners (does not check this itself)
|
void |
removeLockedObjectOwner(String owner)
tries to remove the owner from the lock
|
void |
removeTempLockedObject()
deletes this Lock object. assumes that it has no children and no owners (does not check this itself)
|
void |
setExclusive(boolean exclusive)
Sets the exclusivity for the LockedObject
|
protected int lockDepth
protected long expiresAt
protected String[] owner
protected LockedObject[] children
protected LockedObject parent
protected boolean exclusive
protected String type
public LockedObject(ResourceLocks resLocks, String path, boolean temporary)
resLocks
- the resourceLocks where locks are storedpath
- the path to the locked objecttemporary
- indicates if the LockedObject should be temporary or notpublic boolean addLockedObjectOwner(String owner)
owner
- string that represents the ownerpublic void removeLockedObjectOwner(String owner)
owner
- string that represents the ownerpublic void addChild(LockedObject newChild)
newChild
- new childpublic void removeLockedObject()
public void removeTempLockedObject()
public boolean checkLocks(boolean exclusive, int depth)
exclusive
- wheather the new lock should be exclusivedepth
- the depth to which should be checkedpublic void refreshTimeout(int timeout)
timeout
- public long getTimeoutMillis()
public boolean hasExpired()
public String getID()
public String[] getOwner()
public String getPath()
public void setExclusive(boolean exclusive)
exclusive
- public boolean isExclusive()
public boolean isShared()
public String getType()
public int getLockDepth()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.