/** * Return whether this lock has already been held, * <p/> * Notice that, holding the exclusive lock or shared lock are both considered as locked, i.e, this * method usually equals to {@code hasExclusiveLock() || getSharedLockCount() > 0}. */ default boolean isLocked() { return hasExclusiveLock() || getSharedLockCount() > 0; }
@Override public String toString() { return String.format("%s(%s, xlock=%s sharedLock=%s size=%s)", getClass().getSimpleName(), key, lockStatus.hasExclusiveLock() ? "true (" + lockStatus.getExclusiveLockProcIdOwner() + ")" : "false", lockStatus.getSharedLockCount(), size()); } }
/** * Return whether this lock has already been held, * <p/> * Notice that, holding the exclusive lock or shared lock are both considered as locked, i.e, this * method usually equals to {@code hasExclusiveLock() || getSharedLockCount() > 0}. */ default boolean isLocked() { return hasExclusiveLock() || getSharedLockCount() > 0; }