Interface AsyncLockCallback

    • Method Detail

      • onLockAcquire

        void onLockAcquire​(DistributedLock lock)
        Gets called when lock was successfully acquired.

        The acquired lock is bound to the thread that calls this method (i.e. DistributedLock.isHeldByCurrentThread() will return true if called within this method). Note that lock will NOT be automatically released after this methods finishes its execution. It is up to the implementation to decide when lock should be released.

        Parameters:
        lock - Lock.
      • onLockBusy

        default void onLockBusy​(LockOwnerInfo owner)
        Gets called when initial attempt to acquire the lock failed because of the lock is being held by some other node or thread.

        Note that lock will still remain in a waiting state after this method gets called and once the lock gets acquired then the onLockAcquire(DistributedLock) method will be called.

        Parameters:
        owner - Current lock owner.
      • onLockOwnerChange

        default void onLockOwnerChange​(LockOwnerInfo owner)
        Gets called when lock owner changes while the callback is still waiting for the lock to be acquired.

        Note that lock will still remain in a waiting state after this method gets called and once the lock gets acquired then the onLockAcquire(DistributedLock) method will be called.

        Parameters:
        owner - New lock owner.
      • onLockRelease

        default void onLockRelease​(DistributedLock lock)
        Gets called after lock has been released. Note that this method gets called only if the lock was previously acquired.
        Parameters:
        lock - Released lock.