C# Class Lucene.Net.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(); 
Inheritance: IDisposable
Show file Open project: paulirwin/lucene.net Class Usage Examples

Public Properties

Property Type Description
LOCK_POLL_INTERVAL long

Public Methods

Method Description
Dispose ( ) : void
Obtain ( ) : bool

Attempts to obtain exclusive access and immediately return upon success or failure. Use #close to release the lock.

Obtain ( long lockWaitTimeout ) : bool

Attempts to obtain an exclusive lock within amount of time given. Polls once per #LOCK_POLL_INTERVAL (currently 1000) milliseconds until lockWaitTimeout is passed.

Release ( ) : void

Releases exclusive access.

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Obtain() public abstract method

Attempts to obtain exclusive access and immediately return upon success or failure. Use #close to release the lock.
public abstract Obtain ( ) : bool
return bool

Obtain() public method

Attempts to obtain an exclusive lock within amount of time given. Polls once per #LOCK_POLL_INTERVAL (currently 1000) milliseconds until lockWaitTimeout is passed.
if lock wait times out if lockWaitTimeout is /// out of bounds if obtain() throws System.IO.IOException
public Obtain ( long lockWaitTimeout ) : bool
lockWaitTimeout long length of time to wait in /// milliseconds or {@link /// #LOCK_OBTAIN_WAIT_FOREVER} to retry forever
return bool

Release() public abstract method

Releases exclusive access.
public abstract Release ( ) : void
return void

Property Details

LOCK_POLL_INTERVAL public static property

How long #obtain(long) waits, in milliseconds, in between attempts to acquire the lock.
public static long LOCK_POLL_INTERVAL
return long