Class DeadlockException

All Implemented Interfaces:
Serializable

public class DeadlockException extends LockTimeoutException
Thrown when a lock request by a transaction timed out due to a deadlock, or a trivial deadlock was quickly detected. Deadlocks can be prevented by locking records in a consistent order. Cases of "self deadlock" when using multiple transactions in one thread are not detected, and a regular timeout exception is thrown instead.
See Also:
  • Constructor Details

    • DeadlockException

      public DeadlockException(long nanosTimeout)
      Parameters:
      nanosTimeout - negative is interpreted as infinite wait
    • DeadlockException

      public DeadlockException(long nanosTimeout, Object attachment, boolean guilty)
      Parameters:
      nanosTimeout - negative is interpreted as infinite wait
    • DeadlockException

      public DeadlockException(long nanosTimeout, Object attachment, boolean guilty, Set<DeadlockInfo> set)
      Parameters:
      nanosTimeout - negative is interpreted as infinite wait
  • Method Details

    • isGuilty

      public boolean isGuilty()
      Returns:
      true if caller helped caused the deadlock; false if caller might be innocent
    • deadlockSet

      public Set<DeadlockInfo> deadlockSet()
      Returns:
      the set of lock requests which were in a deadlock
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class LockTimeoutException
    • shortMessage

      public String shortMessage()
      Returns:
      message without deadlock set info