Package org.eclipse.rdf4j.sail.helpers
Class DirectoryLockManager
java.lang.Object
org.eclipse.rdf4j.sail.helpers.DirectoryLockManager
- All Implemented Interfaces:
LockManager
Used to create a lock in a directory.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Lock
createLock
(RandomAccessFile raf, FileLock fileLock) Technical description of where the lock is located, such as a URL.private File
private String
private String
boolean
isLocked()
Determines if the directory is locked.Creates a lock in a directory if it does not yet exist.private void
removeInvalidLock
(File lockDir) boolean
Revokes a lock owned by another process.private void
tryLock()
Creates a lock in a directory if it does not yet exist.
-
Field Details
-
LOCK_DIR_NAME
- See Also:
-
LOCK_FILE_NAME
- See Also:
-
INFO_FILE_NAME
- See Also:
-
logger
private final org.slf4j.Logger logger -
dir
-
-
Constructor Details
-
DirectoryLockManager
-
-
Method Details
-
getLocation
Description copied from interface:LockManager
Technical description of where the lock is located, such as a URL.- Specified by:
getLocation
in interfaceLockManager
-
getLockDir
-
isLocked
public boolean isLocked()Determines if the directory is locked.- Specified by:
isLocked
in interfaceLockManager
- Returns:
true
if the directory is already locked.
-
tryLock
Creates a lock in a directory if it does not yet exist.- Specified by:
tryLock
in interfaceLockManager
- Returns:
- a newly acquired lock or null if the directory is already locked.
-
lockOrFail
Creates a lock in a directory if it does not yet exist.- Specified by:
lockOrFail
in interfaceLockManager
- Returns:
- a newly acquired lock.
- Throws:
SailLockedException
- if the directory is already locked.
-
revokeLock
public boolean revokeLock()Revokes a lock owned by another process.- Specified by:
revokeLock
in interfaceLockManager
- Returns:
true
if a lock was successfully revoked.
-
removeInvalidLock
-
getLockedBy
-
createLock
-
sign
- Throws:
IOException
-
getProcessName
-