Package com.yahoo.vespa.curator
Class Lock
- java.lang.Object
-
- com.yahoo.vespa.curator.Lock
-
- All Implemented Interfaces:
com.yahoo.transaction.Mutex
,AutoCloseable
public class Lock extends Object implements com.yahoo.transaction.Mutex
A cluster-wide re-entrant mutex which is released on (the last symmetric) close. Re-entrancy is limited to the instance of this. To ensure re-entrancy callers should access the lock throughCurator.lock(Path, Duration)
instead of constructing this directly.- Author:
- bratseth
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquire(Duration timeout)
Take the lock with the given timeout.void
close()
-
-
-
Method Detail
-
acquire
public void acquire(Duration timeout) throws com.yahoo.concurrent.UncheckedTimeoutException
Take the lock with the given timeout. This may be called multiple times from the same thread - each matched by a close- Throws:
com.yahoo.concurrent.UncheckedTimeoutException
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacecom.yahoo.transaction.Mutex
-
-