|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.store.Lock
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();
Directory.makeLock(String)
Nested Class Summary | |
static class |
Lock.With
Utility class for executing code with exclusive access. |
Field Summary | |
static long |
LOCK_POLL_INTERVAL
|
Constructor Summary | |
Lock()
|
Method Summary | |
abstract boolean |
isLocked()
Returns true if the resource is currently locked. |
abstract boolean |
obtain()
Attempts to obtain exclusive access and immediately return upon success or failure. |
boolean |
obtain(long lockWaitTimeout)
Attempts to obtain an exclusive lock within amount of time given. |
abstract void |
release()
Releases exclusive access. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static long LOCK_POLL_INTERVAL
Constructor Detail |
public Lock()
Method Detail |
public abstract boolean obtain() throws java.io.IOException
java.io.IOException
public boolean obtain(long lockWaitTimeout) throws java.io.IOException
lockWaitTimeout
- length of time to wait in ms
java.io.IOException
- if lock wait times out or obtain() throws an IOExceptionpublic abstract void release()
public abstract boolean isLocked()
obtain()
before using the resource.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |