Enum Class LockResult

java.lang.Object
java.lang.Enum<LockResult>
org.cojen.tupl.LockResult
All Implemented Interfaces:
Serializable, Comparable<LockResult>, Constable

public enum LockResult extends Enum<LockResult>
Result code returned by transactional operations which acquire locks.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Lock granted for the first time.
    Lock rejection caused by deadlock.
    Lock rejection caused by illegal lock mode upgrade.
    Lock rejection caused by thread interruption.
    Exclusive lock is already owned, so no extra unlock should be performed.
    Shared lock is already owned, so no extra unlock should be performed.
    Upgradable lock is already owned, so no extra unlock should be performed.
    Lock rejection caused by wait timeout or deadlock.
    Indicates that the lock isn't owned, or that lock acquisition wasn't performed.
    Exclusive lock granted as an upgrade from an owned upgradable lock.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if a lock was just acquired.
    boolean
    Returns true if lock was already owned when requested.
    boolean
    Returns true if lock was just acquired or was already owned.
    boolean
    Returns true if lock request timed out.
    static LockResult
    Returns the enum constant of this class with the specified name.
    static LockResult[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ILLEGAL

      public static final LockResult ILLEGAL
      Lock rejection caused by illegal lock mode upgrade.
      See Also:
    • INTERRUPTED

      public static final LockResult INTERRUPTED
      Lock rejection caused by thread interruption.
      See Also:
    • TIMED_OUT_LOCK

      public static final LockResult TIMED_OUT_LOCK
      Lock rejection caused by wait timeout or deadlock.
      See Also:
    • DEADLOCK

      public static final LockResult DEADLOCK
      Lock rejection caused by deadlock.
    • ACQUIRED

      public static final LockResult ACQUIRED
      Lock granted for the first time.
    • UPGRADED

      public static final LockResult UPGRADED
      Exclusive lock granted as an upgrade from an owned upgradable lock.
    • OWNED_SHARED

      public static final LockResult OWNED_SHARED
      Shared lock is already owned, so no extra unlock should be performed. This result is only possible when trying to acquire a shared lock.
    • OWNED_UPGRADABLE

      public static final LockResult OWNED_UPGRADABLE
      Upgradable lock is already owned, so no extra unlock should be performed. This result is possible when trying to acquire a shared or upgradable lock.
    • OWNED_EXCLUSIVE

      public static final LockResult OWNED_EXCLUSIVE
      Exclusive lock is already owned, so no extra unlock should be performed. This result is possible when trying to acquire any type of lock.
    • UNOWNED

      public static final LockResult UNOWNED
      Indicates that the lock isn't owned, or that lock acquisition wasn't performed. Unless returned from an explicit lock check method, this result doesn't imply that the lock is truly unowned.
      See Also:
  • Method Details

    • values

      public static LockResult[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LockResult valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isTimedOut

      public boolean isTimedOut()
      Returns true if lock request timed out. Applicable to TIMED_OUT_LOCK.
    • isHeld

      public boolean isHeld()
      Returns true if lock was just acquired or was already owned. Applicable to ACQUIRED, UPGRADED, OWNED_SHARED, OWNED_UPGRADABLE, and OWNED_EXCLUSIVE.
    • isAlreadyOwned

      public boolean isAlreadyOwned()
      Returns true if lock was already owned when requested. Applicable to OWNED_SHARED, OWNED_UPGRADABLE, and OWNED_EXCLUSIVE.
    • isAcquired

      public boolean isAcquired()
      Returns true if a lock was just acquired. Applicable to ACQUIRED and UPGRADED.