Package org.apache.lucene.store
Class Lock.With
java.lang.Object
org.apache.lucene.store.Lock.With
- Enclosing class:
- Lock
Utility class for executing code with exclusive access.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
With
Constructs an executor that will grab the named lock.
-
-
Method Details
-
doBody
Code to execute with exclusive access.- Throws:
IOException
-
run
CallsdoBody()
while lock is obtained. Blocks if lock cannot be obtained immediately. Retries to obtain lock once per second until it is obtained, or until it has tried ten times. Lock is released whendoBody()
exits.- Throws:
LockObtainFailedException
- if lock could not be obtainedIOException
- ifLock.obtain()
throws IOException
-