Class LockInfo

  • public abstract class LockInfo
    extends Object
    Internal lock information.
    • Constructor Detail

      • LockInfo

        protected LockInfo​(NodeId id,
                           boolean sessionScoped,
                           boolean deep,
                           String lockOwner,
                           long timeoutHint)
        Create a new instance of this class.
        id - lock holder node id
        sessionScoped - whether lock token is session scoped
        deep - whether lock is deep
        lockOwner - owner of lock
        timeoutHint - lock timeout hint in seconds
      • LockInfo

        protected LockInfo​(LockInfo that)
    • Method Detail

      • getLockToken

        public String getLockToken()
        Return the lock token associated with this lock.
        lock token
      • getId

        public NodeId getId()
        Return the ID of the lock holding node
        the id
      • getLockOwner

        public String getLockOwner()
        Return the lock owner.
        lock owner
      • isDeep

        public boolean isDeep()
        Return a flag indicating whether the lock is deep.
        true if the lock is deep; false otherwise
      • isLockHolder

        public boolean isLockHolder​(Session session)
        Return a flag indicating whether the session given is lock holder.
        session - session to compare with
      • getLockHolder

        public SessionImpl getLockHolder()
        Return the session currently holding the lock
        session currently holding the lock
      • setLockHolder

        public void setLockHolder​(SessionImpl lockHolder)
        Set the session currently holding the lock
        lockHolder - session currently holding the lock
      • isLive

        public boolean isLive()
        Return a flag indicating whether the lock is live
        true if the lock is live; otherwise false
      • setLive

        public void setLive​(boolean live)
        Set the live flag
        live - live flag
      • mayChange

        public boolean mayChange()
        Return a flag indicating whether the lock information may still change.
        true if the lock is still alive.
      • isSessionScoped

        public boolean isSessionScoped()
        Return a flag indicating whether the lock is session-scoped
        true if the lock is session-scoped; otherwise false
      • getTimeoutHint

        public long getTimeoutHint()
        Returns the timeout hint given when the lock was created.
        timeout hint (in seconds)
      • getTimeoutTime

        public long getTimeoutTime()
        Returns the time when this lock will expire.
        timeout time in milliseconds since the epoch
      • isExpired

        public boolean isExpired()
      • updateTimeoutTime

        public void updateTimeoutTime()
        Updates the timeout time of this lock based on current time and the timeout hint specified for this lock. The timeout time is always rounded up.
      • throwLockException

        public void throwLockException​(String message,
                                       SessionImpl session)
                                throws LockException,
        Utility method that throws a 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 message
        session - session that the user was using for the failing operation
        LockException - always thrown, unless another error occurs
        RepositoryException - if the path of this lock can not be resolved
      • parseLockToken

        public static NodeId parseLockToken​(String token)
                                     throws IllegalArgumentException
        Parse a lock token string representation and return the lock holder node id.
        token - string representation of lock token
        lock holder node id
        IllegalArgumentException - if some field is illegal