|
Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
An interprocess mutex lock. Typical use might look like: More...
Inherited by Lucene.Net.Store.NativeFSLock, Lucene.Net.Store.NoLock, Lucene.Net.Store.SimpleFSLock, Lucene.Net.Store.SingleInstanceLock, and Lucene.Net.Store.VerifyingLockFactory.CheckedLock.
Classes | |
| class | With |
| Utility class for executing code with exclusive access. More... | |
Public Member Functions | |
| abstract bool | Obtain () |
| Attempts to obtain exclusive access and immediately return upon success or failure. | |
| virtual bool | Obtain (long lockWaitTimeout) |
| Attempts to obtain an exclusive lock within amount of time given. Polls once per LOCK_POLL_INTERVAL (currently 1000) milliseconds until lockWaitTimeout is passed. | |
| abstract void | Release () |
| Releases exclusive access. | |
| abstract bool | IsLocked () |
| Returns true if the resource is currently locked. Note that one must still call Obtain() before using the resource. | |
Public Attributes | |
| const long | LOCK_OBTAIN_WAIT_FOREVER = - 1 |
| Pass this value to Obtain(long) to try forever to obtain the lock. | |
Static Public Attributes | |
| static long | LOCK_POLL_INTERVAL = 1000 |
| How long Obtain(long) waits, in milliseconds, in between attempts to acquire the 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();
|
pure virtual |
Returns true if the resource is currently locked. Note that one must still call Obtain() before using the resource.
Implemented in Lucene.Net.Store.NativeFSLock, Lucene.Net.Store.SimpleFSLock, Lucene.Net.Store.SingleInstanceLock, and Lucene.Net.Store.NoLock.
|
pure virtual |
Attempts to obtain exclusive access and immediately return upon success or failure.
Implemented in Lucene.Net.Store.NativeFSLock, Lucene.Net.Store.SimpleFSLock, Lucene.Net.Store.SingleInstanceLock, and Lucene.Net.Store.NoLock.
|
virtual |
Attempts to obtain an exclusive lock within amount of time given. Polls once per LOCK_POLL_INTERVAL (currently 1000) milliseconds until lockWaitTimeout is passed.
| lockWaitTimeout | length of time to wait in milliseconds or LOCK_OBTAIN_WAIT_FOREVER to retry forever |
<throws> LockObtainFailedException if lock wait times out </throws> <throws> IllegalArgumentException if lockWaitTimeout is </throws>
out of bounds
<throws> IOException if obtain() throws IOException </throws>
|
pure virtual |
Releases exclusive access.
Implemented in Lucene.Net.Store.NativeFSLock, Lucene.Net.Store.SimpleFSLock, Lucene.Net.Store.SingleInstanceLock, and Lucene.Net.Store.NoLock.
| const long Lucene.Net.Store.Lock.LOCK_OBTAIN_WAIT_FOREVER = - 1 |
Pass this value to Obtain(long) to try forever to obtain the lock.
|
static |
How long Obtain(long) waits, in milliseconds, in between attempts to acquire the lock.
1.8.3