Package org.apache.lucene.store
Class Lock.With
- java.lang.Object
-
- org.apache.lucene.store.Lock.With
-
- Enclosing class:
- Lock
public abstract static class Lock.With extends java.lang.Object
Utility class for executing code with exclusive access.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
run()
CallsdoBody()
while lock is obtained.
-
-
-
Constructor Detail
-
With
public With(Lock lock, long lockWaitTimeout)
Constructs an executor that will grab the named lock.
-
-
Method Detail
-
run
public java.lang.Object run() throws java.io.IOException
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 obtainedjava.io.IOException
- ifLock.obtain()
throws IOException
-
-