| java.lang.Object org.apache.lucene.store.Lock
All known Subclasses: org.apache.lucene.store.je.JELock, org.apache.lucene.store.db.DbLock,
Lock | abstract public class Lock (Code) | | An interprocess mutex lock.
Typical use might look like:
new Lock.With(directory.makeLock("my.lock")) {
public Object doBody() {
... code to execute while locked ...
}
}.run();
version: $Id: Lock.java 595448 2007-11-15 20:42:54Z mikemccand $ See Also: Directory.makeLock(String) |
Inner Class :abstract public static class With | |
Method Summary | |
abstract public boolean | isLocked() Returns true if the resource is currently locked. | abstract public boolean | obtain() Attempts to obtain exclusive access and immediately return
upon success or failure. | public boolean | obtain(long lockWaitTimeout) Attempts to obtain an exclusive lock within amount of
time given. | abstract public void | release() Releases exclusive access. |
LOCK_OBTAIN_WAIT_FOREVER | final public static long LOCK_OBTAIN_WAIT_FOREVER(Code) | | Pass this value to
Lock.obtain(long) to try
forever to obtain the lock.
|
LOCK_POLL_INTERVAL | public static long LOCK_POLL_INTERVAL(Code) | | How long
Lock.obtain(long) waits, in milliseconds,
in between attempts to acquire the lock.
|
failureReason | protected Throwable failureReason(Code) | | If a lock obtain called, this failureReason may be set
with the "root cause" Exception as to why the lock was
not obtained.
|
isLocked | abstract public boolean isLocked()(Code) | | Returns true if the resource is currently locked. Note that one must
still call
Lock.obtain() before using the resource.
|
obtain | abstract public boolean obtain() throws IOException(Code) | | Attempts to obtain exclusive access and immediately return
upon success or failure.
true iff exclusive access is obtained |
release | abstract public void release() throws IOException(Code) | | Releases exclusive access.
|
|
|