Class ReleaseLockException
java.lang.Object
java.lang.Throwable
java.lang.Exception
de.aristaflow.adept2.util.LockException
de.aristaflow.adept2.util.locking.ReleaseLockException
- All Implemented Interfaces:
Serializable
An
ReleaseLockException indicates that the lock on an object
can not be released since the releasing object does not have the lock. This
is usually a programming error since unlocking should always have a
corresponding lock some time before.- Author:
- Ulrich Kreher
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether the object is already locked (but not by the lock releasing object) or is not locked at all.protected final ObjectThe object trying to release the lock (but failing). -
Constructor Summary
ConstructorsConstructorDescriptionReleaseLockException(Object lockedObject, boolean locked, Object lockReleasingObject, String lockType) Creates a new lock exception indicating that the designatedlockReleasingObjectcan not unlock the designatedlockedObjectbut the current lock owner is unknown or the object is not locked at all.ReleaseLockException(Object lockedObject, Object lockOwner, Object lockReleasingObject, String lockType) Creates a new lock exception indicating that the designatedlockReleasingObjectcan not unlock the designatedlockedObjectsince it does not have the lock but thelockOwnerhas. -
Method Summary
Modifier and TypeMethodDescriptionReturns the object that wants to release the lock.booleanisLocked()Wether the exception occurred due to another object having the lock (true) or having no lock at all (false).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
-
Field Details
-
locked
protected final boolean lockedWhether the object is already locked (but not by the lock releasing object) or is not locked at all. -
lockReleasingObject
The object trying to release the lock (but failing).
-
-
Constructor Details
-
ReleaseLockException
public ReleaseLockException(Object lockedObject, boolean locked, Object lockReleasingObject, String lockType) Creates a new lock exception indicating that the designatedlockReleasingObjectcan not unlock the designatedlockedObjectbut the current lock owner is unknown or the object is not locked at all.- Parameters:
lockedObject- The object that is currently locked and that should be unlocked.locked- Whether the object is locked (and the lock owner is unknown).lockReleasingObject- The object that wanted to release the lock which led to the created exception.lockType- The type of the lock which can not be released.
-
ReleaseLockException
public ReleaseLockException(Object lockedObject, Object lockOwner, Object lockReleasingObject, String lockType) Creates a new lock exception indicating that the designatedlockReleasingObjectcan not unlock the designatedlockedObjectsince it does not have the lock but thelockOwnerhas.- Parameters:
lockedObject- The object that is currently locked and that should be unlocked.lockOwner- The object that currently locks the object.lockReleasingObject- The object that wanted to release the lock which led to the created exception.lockType- The type of the lock which can not be released.
-
-
Method Details
-
isLocked
public boolean isLocked()Wether the exception occurred due to another object having the lock (true) or having no lock at all (false).- Returns:
- Whether the object is already locked by another object or not locked at all.
-
getLockReleasingObject
Returns the object that wants to release the lock.- Returns:
- The object that wants to release the lock.
-
getMessage
- Overrides:
getMessagein classThrowable
-