public abstract class LockInfo extends Object
Modifier | Constructor and Description |
---|---|
protected |
LockInfo(LockInfo that) |
protected |
LockInfo(NodeId id,
boolean sessionScoped,
boolean deep,
String lockOwner,
long timeoutHint)
Create a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
NodeId |
getId()
Return the ID of the lock holding node
|
SessionImpl |
getLockHolder()
Return the session currently holding the lock
|
String |
getLockOwner()
Return the lock owner.
|
String |
getLockToken()
Return the lock token associated with this lock.
|
long |
getTimeoutHint()
Returns the timeout hint given when the lock was created.
|
long |
getTimeoutTime()
Returns the time when this lock will expire.
|
boolean |
isDeep()
Return a flag indicating whether the lock is deep.
|
boolean |
isExpired() |
boolean |
isLive()
Return a flag indicating whether the lock is live
|
boolean |
isLockHolder(Session session)
Return a flag indicating whether the session given is lock holder.
|
boolean |
isSessionScoped()
Return a flag indicating whether the lock is session-scoped
|
boolean |
mayChange()
Return a flag indicating whether the lock information may still change.
|
static NodeId |
parseLockToken(String token)
Parse a lock token string representation and return the lock
holder node id.
|
void |
setLive(boolean live)
Set the live flag
|
void |
setLockHolder(SessionImpl lockHolder)
Set the session currently holding the lock
|
void |
throwLockException(String message,
SessionImpl session)
Utility method that throws a
LockException with the
"failure node path" set to the path of the node that holds this lock. |
String |
toString() |
void |
updateTimeoutTime()
Updates the timeout time of this lock based on current time and
the timeout hint specified for this lock.
|
protected LockInfo(NodeId id, boolean sessionScoped, boolean deep, String lockOwner, long timeoutHint)
id
- lock holder node idsessionScoped
- whether lock token is session scopeddeep
- whether lock is deeplockOwner
- owner of locktimeoutHint
- lock timeout hint in secondsprotected LockInfo(LockInfo that)
public String getLockToken()
public NodeId getId()
public String getLockOwner()
public boolean isDeep()
true
if the lock is deep;
false
otherwisepublic boolean isLockHolder(Session session)
session
- session to compare withpublic SessionImpl getLockHolder()
public void setLockHolder(SessionImpl lockHolder)
lockHolder
- session currently holding the lockpublic boolean isLive()
true
if the lock is live; otherwise false
public void setLive(boolean live)
live
- live flagpublic boolean mayChange()
true
if the lock is still alive.public boolean isSessionScoped()
true
if the lock is session-scoped;
otherwise false
public long getTimeoutHint()
public long getTimeoutTime()
public boolean isExpired()
public void updateTimeoutTime()
public void throwLockException(String message, SessionImpl session) throws LockException, RepositoryException
LockException
with the
"failure node path" set to the path of the node that holds this lock.
The given session is used to resolve the path of the lock holder node.message
- exception messagesession
- session that the user was using for the failing operationLockException
- always thrown, unless another error occursRepositoryException
- if the path of this lock can not be resolvedpublic static NodeId parseLockToken(String token) throws IllegalArgumentException
token
- string representation of lock tokenIllegalArgumentException
- if some field is illegalCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.