public static abstract class

Lock.With

extends Object
java.lang.Object
   ↳ org.apache.lucene.store.Lock.With

Class Overview

Utility class for executing code with exclusive access.

Summary

Public Constructors
Lock.With(Lock lock, long lockWaitTimeout)
Constructs an executor that will grab the named lock.
Public Methods
Object run()
Calls doBody() while lock is obtained.
Protected Methods
abstract Object doBody()
Code to execute with exclusive access.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Lock.With (Lock lock, long lockWaitTimeout)

Constructs an executor that will grab the named lock.

Public Methods

public Object run ()

Calls doBody() while lock is obtained. Blocks if lock cannot be obtained immediately. Retries to obtain lock once per second until it is obtained, or until it has tried ten times. Lock is released when doBody() exits.

Throws
LockObtainFailedException if lock could not be obtained
IOException if obtain() throws IOException

Protected Methods

protected abstract Object doBody ()

Code to execute with exclusive access.

Throws
IOException