Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Lucene.Net.Store.Lock Class Referenceabstract

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.
 

Detailed Description

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();

See Also
Directory.MakeLock(String)

Definition at line 34 of file Lock.cs.

Member Function Documentation

abstract bool Lucene.Net.Store.Lock.IsLocked ( )
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.

abstract bool Lucene.Net.Store.Lock.Obtain ( )
pure virtual

Attempts to obtain exclusive access and immediately return upon success or failure.

Returns
true iff exclusive access is obtained

Implemented in Lucene.Net.Store.NativeFSLock, Lucene.Net.Store.SimpleFSLock, Lucene.Net.Store.SingleInstanceLock, and Lucene.Net.Store.NoLock.

virtual bool Lucene.Net.Store.Lock.Obtain ( long  lockWaitTimeout)
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.

Parameters
lockWaitTimeoutlength of time to wait in milliseconds or LOCK_OBTAIN_WAIT_FOREVER to retry forever
Returns
true if lock was obtained

<throws> LockObtainFailedException if lock wait times out </throws> <throws> IllegalArgumentException if lockWaitTimeout is </throws>

out of bounds

<throws> IOException if obtain() throws IOException </throws>

Definition at line 76 of file Lock.cs.

abstract void Lucene.Net.Store.Lock.Release ( )
pure virtual

Member Data Documentation

const long Lucene.Net.Store.Lock.LOCK_OBTAIN_WAIT_FOREVER = - 1

Pass this value to Obtain(long) to try forever to obtain the lock.

Definition at line 45 of file Lock.cs.

long Lucene.Net.Store.Lock.LOCK_POLL_INTERVAL = 1000
static

How long Obtain(long) waits, in milliseconds, in between attempts to acquire the lock.

Definition at line 40 of file Lock.cs.


The documentation for this class was generated from the following file: