public final class ResourceLock extends Object
A representation of an acquired lock. A ResourceLock governs a URI and optionally some fragment identifiers. A resource lock indicates the URI of the resource being governed, the fragment identifiers, a time-to-live, and a message.
Instances of these locks are obtained in one of two ways:
getLocks()
which returns a list of all locks for a given
resourceget()
which returns a single lock based on the lock's identifier.In any case the same ResourceLock may be obtained. ResourceLocks themselves are immutable, although the state of
the ResourceLocks may change, just not by operating on the ResourceLock instance itself. As such, ResourceLocks
should not be cached or kept for a long time, but rather refetched from the ResourceLockManager
to verify
that they are valid and that their state hasn't changed.
A resource lock is defined to be equal another resource lock if and only if the unique identifier used to obtain this resource lock are equal
ResourceLockManager
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Indicates if another resource lock is the same as this one.
|
Date |
getCreationDate()
The date/time when the lock was acquired.
|
Date |
getExpireDate()
The date/time when the lock will be expired.
|
List<String> |
getFragments()
The list of fragments that this ResourceLock governs, or an empty list if the lock governs the entire resource.
|
String |
getHash()
A unique hash of this resource lock.
|
String |
getMessage()
The message from the client regarding this resource lock.
|
URI |
getURI()
The URI of the resource that is governed by this lock.
|
int |
getUserId()
The id of the owner of this lock.
|
String |
getUsername()
The username of the owner of this lock.
|
int |
hashCode() |
String |
toString() |
public String getHash()
public URI getURI()
public List<String> getFragments()
public String getMessage()
public int getUserId()
ResourceLockManager.obtainLock(java.net.URI,java.util.List,long,String)
public String getUsername()
ResourceLockManager.obtainLock(java.net.URI,java.util.List,long,String)
null
if the owner is anonymouspublic Date getCreationDate()
public Date getExpireDate()
public boolean equals(Object o)
© 1998- 2018 Stibo DX