org.apache.lucene.store
Class Lock.With
java.lang.Object
org.apache.lucene.store.Lock.With
- Lock
public static abstract class Lock.With
extends java.lang.Object
Utility class for executing code with exclusive access.
With(Lock lock) - Kept only to avoid breaking existing code.
|
With(Lock lock, long lockWaitTimeout) - Constructs an executor that will grab the named lock.
|
protected Object | doBody() - Code to execute with exclusive access.
|
Object | run() - Calls
doBody() while lock is obtained.
|
With
public With(Lock lock)
Kept only to avoid breaking existing code.
Constructs an executor that will grab the named lock.
Defaults lockWaitTimeout to Lock.COMMIT_LOCK_TIMEOUT.
With
public With(Lock lock,
long lockWaitTimeout)
Constructs an executor that will grab the named lock.
doBody
protected Object doBody()
throws IOException
Code to execute with exclusive access.
run
public Object run()
throws IOException
Calls
doBody()
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 when
doBody()
exits.
Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.