Class DeadlockException
- All Implemented Interfaces:
Serializable
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 Summary
ConstructorsConstructorDescriptionDeadlockException
(long nanosTimeout) DeadlockException
(long nanosTimeout, Object attachment, boolean guilty) DeadlockException
(long nanosTimeout, Object attachment, boolean guilty, Set<DeadlockInfo> set) -
Method Summary
Methods inherited from class org.cojen.tupl.LockTimeoutException
ownerAttachment, timeout, timeoutNanos, unit
Methods inherited from class org.cojen.tupl.LockFailureException
isRecoverable
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DeadlockException
public DeadlockException(long nanosTimeout) - Parameters:
nanosTimeout
- negative is interpreted as infinite wait
-
DeadlockException
- 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
- Returns:
- the set of lock requests which were in a deadlock
-
getMessage
- Overrides:
getMessage
in classLockTimeoutException
-
shortMessage
- Returns:
- message without deadlock set info
-