Class AcquireLockException
java.lang.Object
java.lang.Throwable
java.lang.Exception
de.aristaflow.adept2.util.LockException
de.aristaflow.adept2.util.locking.AcquireLockException
- All Implemented Interfaces:
Serializable
An
This exception is only thrown when a long-term lock blocks an acquisition; a blocking short-term lock is usually indicated by a thrown
AcquireLockException indicates that a lock of a specific
type on an object can not be acquired since the object is already locked by
another locking object (and possibly with another type of lock). Since the
current lock can be released some time in the future, a retry could help.
This exception is only thrown when a long-term lock blocks an acquisition; a blocking short-term lock is usually indicated by a thrown
InterruptedException.- Author:
- Ulrich Kreher
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAcquireLockException(Object lockedObject, Object lockOwner, Object lockAcquiringObject, String lockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedlockTypesince thelockedObjectis already locked (with the same lock type) by the designatedlockOwner.AcquireLockException(Object lockedObject, Object lockAcquiringObject, String lockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedlockTypesince thelockedObjectis already locked (with the same lock type) but the current lock owner is unknown.AcquireLockException(Object lockedObject, Object lockOwner, String currentLockType, Object lockAcquiringObject, String acquiringLockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedacquiringLockTypesince thelockedObjectis already locked (with thecurrentLockType) by the designatedlockOwner.AcquireLockException(Object lockedObject, String currentLockType, Object lockAcquiringObject, String acquiringLockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedacquiringLockTypesince thelockedObjectis already locked (with thecurrentLockType) but the current lock owner is unknown. -
Method Summary
Modifier and TypeMethodDescriptionReturns the type of the lock which was tried to being acquired.Returns the object that wants to acquire the lock.Methods inherited from class de.aristaflow.adept2.util.LockException
getLockedObject, getLockOwner, getLockTypeMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AcquireLockException
Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedlockTypesince thelockedObjectis already locked (with the same lock type) but the current lock owner is unknown.- Parameters:
lockedObject- The object that is currently locked and that should be locked again.lockAcquiringObject- The object that wanted to acquire the lock which lead to the created exception.lockType- The type of the lock which can not be acquired since it is currently held on the object.
-
AcquireLockException
public AcquireLockException(Object lockedObject, String currentLockType, Object lockAcquiringObject, String acquiringLockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedacquiringLockTypesince thelockedObjectis already locked (with thecurrentLockType) but the current lock owner is unknown.- Parameters:
lockedObject- The object that is currently locked and that should be locked again.currentLockType- The type of the lock which is currently held on the object.lockAcquiringObject- The object that wanted to acquire the lock which lead to the created exception.acquiringLockType- The type of the lock which can not be acquired.
-
AcquireLockException
public AcquireLockException(Object lockedObject, Object lockOwner, Object lockAcquiringObject, String lockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedlockTypesince thelockedObjectis already locked (with the same lock type) by the designatedlockOwner.- Parameters:
lockedObject- The object that is currently locked and that should be locked again.lockOwner- The object that currently locks the object.lockAcquiringObject- The object that wanted to acquire the lock which lead to the created exception.lockType- The type of the lock which can not be acquired since it is currently held on the object.
-
AcquireLockException
public AcquireLockException(Object lockedObject, Object lockOwner, String currentLockType, Object lockAcquiringObject, String acquiringLockType) Creates a new lock exception indicating that the designatedlockAcquiringObjectcan not acquire the lock of the designatedacquiringLockTypesince thelockedObjectis already locked (with thecurrentLockType) by the designatedlockOwner.- Parameters:
lockedObject- The object that is currently locked and that should be locked again.lockOwner- The object that currently locks the object.currentLockType- The type of the lock which is currently held on the object.lockAcquiringObject- The object that wanted to acquire the lock which lead to the created exception.acquiringLockType- The type of the lock which can not be acquired.
-
-
Method Details
-
getAcquiringObject
Returns the object that wants to acquire the lock.- Returns:
- The object that wants to acquire the lock.
-
getAcquiringLockType
Returns the type of the lock which was tried to being acquired. This may differ from thelock typecurrently held.- Returns:
- The type of the lock which was tried to being acquired.
-
getMessage
- Overrides:
getMessagein classThrowable
-