public class AmetysHomeLock extends Object
| Modifier and Type | Field and Description |
|---|---|
private static String |
__LOCK_FILE
Name of the lock file within a directory.
|
private File |
_directory
The ametys home directory
|
private File |
_file
The lock file within the directory
|
private String |
_identifier
Unique identifier (canonical path name) of the locked directory.
|
private FileLock |
_lock
The file lock.
|
private RandomAccessFile |
_randomAccessFile
The random access file.
|
| Constructor and Description |
|---|
AmetysHomeLock(File ametysHome)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
_closeRandomAccessFile()
Close the random access file if it is open, and set it to null.
|
private void |
_tryLock()
Try to lock the random access file.
|
void |
acquire()
Lock the Ametys home directory
|
void |
release()
Releases repository lock.
|
private static final String __LOCK_FILE
private File _directory
private RandomAccessFile _randomAccessFile
private String _identifier
public AmetysHomeLock(File ametysHome) throws AmetysHomeLockException
acquire() method.ametysHome - The ametys home directoryAmetysHomeLockException - if the canonical path of the directory can not be determinedpublic void acquire() throws AmetysHomeLockException
AmetysHomeLockException - if the repository lock can not be acquiredprivate void _tryLock() throws AmetysHomeLockException
AmetysHomeLockException - If an error occurs during the lock attempt.private void _closeRandomAccessFile()
public void release()