public final class LockFileManager extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
acquireExclusiveLock(String lockFile,
StringBuilder failureReason)
Attempts to acquire an exclusive lock on the specified file.
|
static boolean |
acquireSharedLock(String lockFile,
StringBuilder failureReason)
Attempts to acquire a shared lock on the specified file.
|
static String |
getBackendLockFileName(Backend<?> backend)
Retrieves the filename that should be used for the lock file for the specified backend.
|
static String |
getServerLockFileName()
Retrieves the filename that should be used for the lock file for the Directory Server instance.
|
static boolean |
releaseLock(String lockFile,
StringBuilder failureReason)
Attempts to release the lock on the specified file.
|
public static boolean acquireSharedLock(String lockFile, StringBuilder failureReason)
lockFile
- The file for which to obtain the shared lock.failureReason
- A buffer that can be used to hold a reason that the lock could not be acquired.true
if the lock was obtained successfully, or false
if it could not be
obtained.public static boolean acquireExclusiveLock(String lockFile, StringBuilder failureReason)
lockFile
- The file for which to obtain the exclusive lock.failureReason
- A buffer that can be used to hold a reason that the lock could not be acquired.true
if the lock was obtained successfully, or false
if it could not be
obtained.public static boolean releaseLock(String lockFile, StringBuilder failureReason)
lockFile
- The file for which to release the associated lock.failureReason
- A buffer that can be used to hold information about a problem that occurred preventing the successful
release.true
if the lock was found and released successfully, or false
if a problem
occurred that might have prevented the lock from being released.public static String getServerLockFileName()
public static String getBackendLockFileName(Backend<?> backend)
backend
- The backend for which to retrieve the filename for the lock file.Copyright 2010-2022 ForgeRock AS.