Class ExclusiveLockHolder

    • Constructor Detail

      • ExclusiveLockHolder

        public ExclusiveLockHolder()
        Default constructor for serialization interfaces
    • Method Detail

      • isLocked

        public boolean isLocked()
        Return true if this lock is currently owned by anyone.
        Returns:
        true if this lock is currently owned by anyone
      • isLockedBy

        public boolean isLockedBy​(LockOwner owner)
        Return true if this lock is currently owned by the specified LockOwner.
        Returns:
        true if this lock is currently owned by he specified LockOwner
      • isLockedByMember

        public boolean isLockedByMember​(UID memberId)
        Return true if this lock is currently owned by the specified member, regardless of which thread on that member owns it.
        Returns:
        true if this lock is currently owned by he specified member
      • lock

        public boolean lock​(LockOwner owner)
        Attempt to acquire the lock.
        Parameters:
        owner - the lock owner to acquire the lock for
        Returns:
        true if the lock was successfully acquired
      • unlock

        public boolean unlock​(LockOwner owner)
        Attempt to release the lock.
        Parameters:
        owner - the lock owner to release the lock for
        Returns:
        true if the specified owner held the lock, and the lock was successfully released
      • getOwner

        public LockOwner getOwner()
        Return the current lock owner, if any.
        Returns:
        the current lock owner, if any; null otherwise
      • removeLocksFor

        protected boolean removeLocksFor​(UID memberId)
        Remove the lock, if it's owned by the specified member.
        Parameters:
        memberId - the UID of a member to remove the locks for
        Returns:
        true if this holder was modified
      • retainLocksFor

        protected boolean retainLocksFor​(Set<UID> setMemberIds)
        Remove the lock if it's NOT owned by one of the specified members.
        Parameters:
        setMemberIds - the UIDs of the member to retain the locks for
        Returns:
        true if this holder was modified