Class LockException

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    AcquireLockException, ReleaseLockException

    public abstract class LockException
    extends Exception
    A LockException indicates that an object can not be locked or unlocked due to being locked (by the wrong object). The exception provides the locked object, the lock owner as well as the type of lock currently held or to be released. The lock owner may be null since it may be unknown or there may not be a lock at all.
    Author:
    Ulrich Kreher
    See Also:
    Serialized Form
    • Constructor Detail

      • LockException

        protected LockException​(Object lockedObject,
                                String lockType)
        Creates a new lock exception indicating that the designated lockedObject can not be locked or unlocked due to the (lack of) a lock of the designated type and the current lock owner is unknown or there is no lock at all.
        Parameters:
        lockedObject - The object that is should be locked or unlocked.
        lockType - The type of the lock which is currently held on the object or should be released.
      • LockException

        protected LockException​(Object lockedObject,
                                Object lockOwner,
                                String lockType)
        Creates a new lock exception indicating that the designated lockedObject can not be locked or unlocked since it is locked by the designated for the lockOwner for the designated lock type.
        Parameters:
        lockedObject - The object that is should be locked or unlocked.
        lockOwner - The object that currently locks the object.
        lockType - The type of the lock which is currently held on the object or should be released.
    • Method Detail

      • getLockedObject

        public Object getLockedObject()
        Returns the object that is to be locked or unlocked.
        Returns:
        The object that is to be locked or unlocked.
      • getLockOwner

        public Object getLockOwner()
        Returns the object that currently has the lock or null in case the lock owner is unknown or there is no lock at all.
        Returns:
        The object that currently has the lock or null in case the lock owner is unknown or there is no lock at all.
      • getLockType

        public String getLockType()
        Returns the type of the lock which is currently held or which is to be released.
        Returns:
        The type of the lock which is currently held or which is to be released.