Search in sources :

Example 1 with OpStatsListener

use of com.twitter.distributedlog.stats.OpStatsListener in project distributedlog by twitter.

the class ZKSessionLock method asyncUnlock.

Future<BoxedUnit> asyncUnlock(final Throwable cause) {
    final Promise<BoxedUnit> promise = new Promise<BoxedUnit>();
    // Use lock executor here rather than lock action, because we want this opertaion to be applied
    // whether the epoch has changed or not. The member node is EPHEMERAL_SEQUENTIAL so there's no
    // risk of an ABA problem where we delete and recreate a node and then delete it again here.
    lockStateExecutor.submit(lockPath, new SafeRunnable() {

        @Override
        public void safeRun() {
            acquireFuture.updateIfEmpty(new Throw<Boolean>(cause));
            unlockInternal(promise);
            promise.addEventListener(new OpStatsListener<BoxedUnit>(unlockStats));
        }
    });
    return promise;
}
Also used : Promise(com.twitter.util.Promise) Throw(com.twitter.util.Throw) SafeRunnable(org.apache.bookkeeper.util.SafeRunnable) BoxedUnit(scala.runtime.BoxedUnit) OpStatsListener(com.twitter.distributedlog.stats.OpStatsListener)

Aggregations

OpStatsListener (com.twitter.distributedlog.stats.OpStatsListener)1 Promise (com.twitter.util.Promise)1 Throw (com.twitter.util.Throw)1 SafeRunnable (org.apache.bookkeeper.util.SafeRunnable)1 BoxedUnit (scala.runtime.BoxedUnit)1