protected static class DatabaseFactory.EnvironmentHolder.DirectoryLock extends Object
A single instance of the DirectoryLock is not intended for inter thread locking. Multiple instance referring to the same File should be used instead.
Modifier and Type | Field | Description |
---|---|---|
static String |
LOCK_FILE_NAME |
Name of warning file.
|
protected File |
m_dir |
Directory to lock.
|
protected FileOutputStream |
m_fstreamLocked |
The FileStream which the actual lock is held on.
|
protected FileLock |
m_lockDir |
The actual FileLock.
|
protected String |
m_sLockText |
Text to include in the lock file.
|
Constructor | Description |
---|---|
DirectoryLock(File dir,
String sLockText) |
Create a DirectoryLock which can be used to try to lock a
directory.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
finalize() |
Automatically release the lock on finalization.
|
boolean |
tryLock() |
Try to lock the directory.
|
boolean |
tryUnlock() |
Try to unlock the directory.
|
public static final String LOCK_FILE_NAME
protected File m_dir
protected FileOutputStream m_fstreamLocked
protected FileLock m_lockDir
protected String m_sLockText
public boolean tryLock() throws IOException
IOException
- if an IO error occurs while creating the
lock filepublic boolean tryUnlock() throws IOException
IOException
- if an IO error occurs while deleting the
lock file, the lock may be left in an
unlocked state