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
public class AcquireLockException extends LockException
AnAcquireLockExceptionindicates 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 thrownInterruptedException.- Author:
- Ulrich Kreher
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description 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.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAcquiringLockType()Returns the type of the lock which was tried to being acquired.ObjectgetAcquiringObject()Returns the object that wants to acquire the lock.StringgetMessage()-
Methods inherited from class de.aristaflow.adept2.util.LockException
getLockedObject, getLockOwner, getLockType
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
AcquireLockException
public 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.- 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 Detail
-
getAcquiringObject
public Object getAcquiringObject()
Returns the object that wants to acquire the lock.- Returns:
- The object that wants to acquire the lock.
-
getAcquiringLockType
public String 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
public String getMessage()
- Overrides:
getMessagein classThrowable
-
-