Package org.apache.jackrabbit.core.util
Class RepositoryLock
- java.lang.Object
-
- org.apache.jackrabbit.core.util.RepositoryLock
-
- All Implemented Interfaces:
RepositoryLockMechanism
public class RepositoryLock extends Object implements RepositoryLockMechanism
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.
-
-
Constructor Summary
Constructors Constructor Description RepositoryLock()RepositoryLock(String path)Deprecated.This constructor is deprecated; use the default constructor andinit(String)instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquire()Lock the repository home.voidinit(String path)Initialize the instance for the given directory path.voidrelease()Releases repository lock.
-
-
-
Constructor Detail
-
RepositoryLock
public RepositoryLock()
-
RepositoryLock
@Deprecated public RepositoryLock(String path) throws RepositoryException
Deprecated.This constructor is deprecated; use the default constructor andinit(String)instead.Create a new RepositoryLock object and initialize it.- Parameters:
path- directory path- Throws:
RepositoryException- if the canonical path of the directory can not be determined
-
-
Method Detail
-
init
public void init(String path) throws RepositoryException
Initialize the instance for the given directory path. The lock still needs to be explicitly acquired using theacquire()method.- Specified by:
initin interfaceRepositoryLockMechanism- Parameters:
path- directory path- Throws:
RepositoryException- if the canonical path of the directory can not be determined
-
acquire
public void acquire() throws RepositoryExceptionLock the repository home.- Specified by:
acquirein interfaceRepositoryLockMechanism- Throws:
RepositoryException- if the repository lock can not be acquired
-
release
public void release()
Releases repository lock.- Specified by:
releasein interfaceRepositoryLockMechanism
-
-