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

    Constructors
    Constructor
    Description
    With(Lock lock, long lockWaitTimeout)
    Constructs an executor that will grab the named lock.
  • Method Summary

    Modifier and Type
    Method
    Description
    run()
    Calls doBody() while lock is obtained.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • With

      public With(Lock lock, long lockWaitTimeout)
      Constructs an executor that will grab the named lock.
  • Method Details

    • run

      public Object run() throws 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