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
public class ReleaseLockException extends LockException
AnReleaseLockException
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
locked
Whether the object is already locked (but not by the lock releasing object) or is not locked at all.protected Object
lockReleasingObject
The object trying to release the lock (but failing).
-
Constructor Summary
Constructors Constructor Description ReleaseLockException(Object lockedObject, boolean locked, Object lockReleasingObject, String lockType)
Creates a new lock exception indicating that the designatedlockReleasingObject
can not unlock the designatedlockedObject
but 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 designatedlockReleasingObject
can not unlock the designatedlockedObject
since it does not have the lock but thelockOwner
has.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getLockReleasingObject()
Returns the object that wants to release the lock.String
getMessage()
boolean
isLocked()
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, getLockType
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
locked
protected final boolean locked
Whether the object is already locked (but not by the lock releasing object) or is not locked at all.
-
lockReleasingObject
protected final Object lockReleasingObject
The object trying to release the lock (but failing).
-
-
Constructor Detail
-
ReleaseLockException
public ReleaseLockException(Object lockedObject, boolean locked, Object lockReleasingObject, String lockType)
Creates a new lock exception indicating that the designatedlockReleasingObject
can not unlock the designatedlockedObject
but 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 designatedlockReleasingObject
can not unlock the designatedlockedObject
since it does not have the lock but thelockOwner
has.- 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 Detail
-
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
public Object getLockReleasingObject()
Returns the object that wants to release the lock.- Returns:
- The object that wants to release the lock.
-
getMessage
public String getMessage()
- Overrides:
getMessage
in classThrowable
-
-