Interface MaintenanceLock
-
- All Known Implementing Classes:
ServerMaintenanceLock
public interface MaintenanceLock
Allows to capture an exclusive maintenance lock and provides basic information about the process which is currently holding the lock- Since:
- 2023.05
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
MaintenanceLock.ProcessInfo
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MaintenanceLock.ProcessInfo
getCurrentProcess()
void
release(MaintenanceProcessKind processKind)
Releases the lock for the specified maintenance process kindboolean
tryCapture(MaintenanceProcessKind processKind, long timeoutMillis)
Tries to capture an exclusive lock for the specified maintenance process kind.
-
-
-
Method Detail
-
tryCapture
boolean tryCapture(@NotNull MaintenanceProcessKind processKind, long timeoutMillis)
Tries to capture an exclusive lock for the specified maintenance process kind. If lock is taken by some other maintenance process, then this method repeats attempts untile the specified timeout happens- Parameters:
processKind
- a kind of the maintenance processtimeoutMillis
- repeats attempts to capture the lock until the timeout happens- Returns:
- true if the lock was captured and false otherwise
-
release
void release(@NotNull MaintenanceProcessKind processKind)
Releases the lock for the specified maintenance process kind- Parameters:
processKind
- a kind of a maintenance process whose lock should be released- Throws:
IllegalArgumentException
- if the currently taken maintenance lock has a different kind
-
getCurrentProcess
@Nullable MaintenanceLock.ProcessInfo getCurrentProcess()
- Returns:
- information about the currently running maintenance process
-
-