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)
_resourceLocks - 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 © 2011-2013. All Rights Reserved.