org.apache.jackrabbit.core.util
Class RepositoryLock

java.lang.Object
  extended by org.apache.jackrabbit.core.util.RepositoryLock

public class RepositoryLock
extends Object

Exclusive lock on a repository home directory. This class encapsulates collective experience on how to acquire an exclusive lock on a given directory. The lock is expected to be exclusive both across process boundaries and within a single JVM. The lock mechanism must also work consistently on a variety of operating systems and JVM implementations.

See Also:
https://issues.apache.org/jira/browse/JCR-213, https://issues.apache.org/jira/browse/JCR-233, https://issues.apache.org/jira/browse/JCR-254, https://issues.apache.org/jira/browse/JCR-912, https://issues.apache.org/jira/browse/JCR-933

Constructor Summary
RepositoryLock(String path)
          Creates a lock instance for the given directory path.
 
Method Summary
 void acquire()
          Lock the repository home.
 void release()
          Releases repository lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryLock

public RepositoryLock(String path)
               throws RepositoryException
Creates a lock instance for the given directory path. An instantiated lock still needs to be explicitly acquired using the acquire() method.

Parameters:
path - directory path
Throws:
RepositoryException - if the canonical path of the directory can not be determined
Method Detail

acquire

public void acquire()
             throws RepositoryException
Lock the repository home.

Throws:
RepositoryException - if the repository lock can not be acquired

release

public void release()
Releases repository lock.



Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.