org.esbtools.eventhandler.lightblue.locking

Interface LockedResource<T>

    • Method Detail

      • ensureAcquiredOrThrow

        void ensureAcquiredOrThrow(String lostLockMessage)
                            throws LostLockException
        Checks if the lock is still acquired or throws a LostLockException.

        Code that relies on a lock should perform this check at critical points.

        You should catch the LostLockException if you need to perform any clean up around losing the lock. The thrown exception will include the provided lostLockMessage which should explain what will happen as a result of the lock being lost.

        If the check fails for another reason, we pessimistically assume the lock was lost, so a LostLockException is also thrown, with the underlying failure as its cause.

        In any case that this method throws LostLockException, no further resource clean up is necessary. The implementation should take care of any necessary cleanup on behalf of the client since we are giving up on the lock... it is lost, after all.

        Throws:
        LostLockException
      • getResource

        T getResource()

Copyright © 2017. All rights reserved.