Package com.yahoo.vespa.curator
Class Lock
java.lang.Object
com.yahoo.vespa.curator.Lock
- All Implemented Interfaces:
com.yahoo.transaction.Mutex
,AutoCloseable
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 through
Curator.lock(Path, Duration)
instead of constructing this directly.- Author:
- bratseth
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Lock
-
Lock
Public for testing only
-
-
Method Details
-
acquire
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
-
lockPath
-
toString
-