Package org.apache.lucene.store
Class Lock.With
- java.lang.Object
-
- org.apache.lucene.store.Lock.With
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Object
doBody()
Code to execute with exclusive access.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
-
doBody
protected abstract Object doBody() throws IOException
Code to execute with exclusive access.- Throws:
IOException
-
run
public Object run() throws 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 obtainedIOException
- ifLock.obtain()
throws IOException
-
-