org.apache.lucene.store
Class Lock

java.lang.Object
  |
  +--org.apache.lucene.store.Lock

public abstract class Lock
extends Object

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

Author:
Doug Cutting
See Also:
Directory.makeLock(String)

Inner Class Summary
static class Lock.With
          Utility class for executing code with exclusive access.
 
Constructor Summary
Lock()
           
 
Method Summary
abstract  boolean obtain()
          Attempt to obtain exclusive access.
abstract  void release()
          Release exclusive access.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Lock

public Lock()
Method Detail

obtain

public abstract boolean obtain()
                        throws IOException
Attempt to obtain exclusive access.
Returns:
true iff exclusive access is obtained

release

public abstract void release()
Release exclusive access.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.