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
    • 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 process
        timeoutMillis - 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