Lock.With (Lucene 3.6.2 API)
Keywords: org.apache.lucene.store.Lock.With class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.store
Class Lock.With

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

Enclosing class:
  Lock

    public abstract static class Lock.With

extends Object

Utility class for executing code with exclusive access.

Constructor Summary
`Lock.With(Lock lock, long lockWaitTimeout)` Constructs an executor that will grab the named lock.

Method Summary
`protected abstract Object` | `doBody()` Code to execute with exclusive access.
`Object` | `run()` Calls `doBody()` while lock is obtained.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Lock.With

    public Lock.With(Lock lock,
                     long lockWaitTimeout)

  Constructs an executor that will grab the named lock.

Method Detail

### doBody

    protected abstract Object doBody()
                              throws IOException

  Code to execute with exclusive access.

  Throws:
    `IOException`

### run

    public Object run()
               throws LockObtainFailedException,
                      IOException

  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 `Lock.obtain()` throws IOException

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD