Class ConfigFileLock
java.lang.Object
com.atlassian.secrets.service.lock.ConfigFileLock
This class provides utility methods for file locking and dealing with quirks of Underlock.
If the application is forcefully terminated, the lock file may not be removed. This will then prevent the application from starting up again. This class provides a method to clean up stale lock files and execute operations under a lock.
If the application is forcefully terminated, the lock file may not be removed. This will then prevent the application from starting up again. This class provides a method to clean up stale lock files and execute operations under a lock.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up stale lock files.voidExecutes an action under a file lock.
-
Field Details
-
LOCK_TIMEOUT_SYS_PROP
- See Also:
-
LOCK_TIMEOUT_DEFAULT_IN_MS
-
STALE_LOCK_DURATION_SYS_PROP
- See Also:
-
STALE_LOCK_DURATION_IN_MS
-
LOCK_FILE_SUFFIX
- See Also:
-
-
Constructor Details
-
ConfigFileLock
-
-
Method Details
-
cleanupStaleLockFile
public void cleanupStaleLockFile()Cleans up stale lock files. The lock file is considered stale if it has not been modified for a certain duration. This duration is specified by the system property "atlassian.secret.service.lock.stale.age" in milliseconds and defaults to 1 minute. -
underLock
Executes an action under a file lock.- Parameters:
action- the action to execute
-