Class AcquireLockException

  • All Implemented Interfaces:
    Serializable

    public class AcquireLockException
    extends LockException
    An 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:
    Serialized Form
    • Constructor Detail

      • AcquireLockException

        public AcquireLockException​(Object lockedObject,
                                    Object lockAcquiringObject,
                                    String lockType)
        Creates a new lock exception indicating that the designated lockAcquiringObject can not acquire the lock of the designated lockType since the lockedObject is 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 designated lockAcquiringObject can not acquire the lock of the designated acquiringLockType since the lockedObject is already locked (with the currentLockType) 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 designated lockAcquiringObject can not acquire the lock of the designated lockType since the lockedObject is already locked (with the same lock type) by the designated lockOwner.
        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 designated lockAcquiringObject can not acquire the lock of the designated acquiringLockType since the lockedObject is already locked (with the currentLockType) by the designated lockOwner.
        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 the lock type currently held.
        Returns:
        The type of the lock which was tried to being acquired.