Interface MaintenanceModeTask

All Superinterfaces:
ScheduleTask

public interface MaintenanceModeTask extends ScheduleTask
A task of this type puts the server into maintenance mode after a customizable period of time. It consists of various stages like displaying a warning message or rejecting new sessions. Each state may have a different duration.
Use ScheduleEntry#createTask(MaintenanceModeTask.class) to create a maintenance mode task for a specific schedule entry
Since:
5.2.516
  • Method Details

    • getMaintenanceName

      @NotNull @NotNull String getMaintenanceName()
      The descriptive name of the maintenance mode started by this task.
      Returns:
      the name of this maintenance mode, never null.
      Since:
      5.2.516
    • setMaintenanceName

      void setMaintenanceName(@NotNull @NotNull String name)
      Set descriptive name of the maintenance mode started by this task.
      Parameters:
      name - the name to set, must not be null.
      Since:
      5.2.518, 5.2.605
    • getMessage

      @NotNull @NotNull String getMessage()
      The message which is displayed to all users once the task has been started. The default is an empty string.
      Returns:
      the message to display, never null.
      Since:
      5.2.516
    • setMessage

      void setMessage(@NotNull @NotNull String message)
      Set the message which is included in all messages regarding this maintenance task.
      Parameters:
      message - the message to display, must not be null.
      Since:
      5.2.516
    • getMessageDisplayType

      @NotNull @NotNull MaintenanceModeTask.MessageDisplayType getMessageDisplayType()
      Indicates how the message is displayed to the users.
      Returns:
      The type of display, never null.
      Since:
      5.2.516
    • setMessageDisplayType

      void setMessageDisplayType(@NotNull @NotNull MaintenanceModeTask.MessageDisplayType messageDisplayType)
      Define how the message of this task should be displayed to the users.
      Parameters:
      messageDisplayType - The type of display, must not be null.
      Since:
      5.2.516
    • getDurationOfStage

      long getDurationOfStage(@NotNull @NotNull MaintenanceModeTask.MaintenanceStage stage)
      Each stage has a duration after which the next stage is started. This method returns the duration for a specific stage or 0 if the stage is disabled.
      Parameters:
      stage - the stage for which to query the duration, must not be null.
      Returns:
      the duration in milliseconds or 0 if the stage is disabled.
      Since:
      5.2.516
      See Also:
    • setDurationOfStage

      void setDurationOfStage(long durationInMilliseconds, @NotNull @NotNull MaintenanceModeTask.MaintenanceStage stage)
      Each stage has a duration after which the next stage is started. This method sets the duration for a specific stage or disables it completely if 0 is used for the duration. There is a default duration for each stage as described in the correspondent enum constant.
      Parameters:
      durationInMilliseconds - the duration for the stage or 0 to disable it completely if allowed for the given stage.
      stage - the stage to set the timeout for, must not be null.
      Throws:
      IllegalArgumentException - if an unknown stage has been specified or the duration is negative.
      Since:
      5.2.516
      See Also:
    • getDisconnectMode

      @NotNull @NotNull MaintenanceModeTask.DisconnectMode getDisconnectMode()
      Indicates the handling of existing sessions once the stage MaintenanceModeTask.MaintenanceStage.MAINTENANCE_MODE_ACTIVE begins.
      Returns:
      The disconnect mode, never null. Default is KEEP_SESSIONS_ALIVE
      Since:
      5.2.516
    • setDisconnectMode

      void setDisconnectMode(@NotNull @NotNull MaintenanceModeTask.DisconnectMode disconnectMode)
      Defines how existing sessions are handled once the stage MaintenanceModeTask.MaintenanceStage.MAINTENANCE_MODE_ACTIVE begins.
      Parameters:
      disconnectMode - The disconnect mode, must not be null.
      Since:
      5.2.516
    • getMaintenanceScope

      @NotNull @NotNull MaintenanceModeTask.MaintenanceScope getMaintenanceScope()
      Indicates the scope of this maintenance task, i.e. if only certain projects or the whole server is affected.
      Returns:
      the maintenance scope, never null. Default is GLOBAL
      Since:
      5.2.516
    • setMaintenanceScope

      void setMaintenanceScope(@NotNull @NotNull MaintenanceModeTask.MaintenanceScope maintenanceScope)
      Defines the scope of this maintenance task.
      Parameters:
      maintenanceScope - the maintenance scope, must not be null.
      Since:
      5.2.516
    • getConcurrentTaskHandling

      @NotNull @NotNull MaintenanceModeTask.ConcurrentTaskHandling getConcurrentTaskHandling()
      Indicates if other tasks may be executed while the maintenance mode is active.
      Returns:
      an enum describing how concurrent tasks are handled, never null. Default is ALLOW_OTHER_TASKS
      Since:
      5.2.516
    • setConcurrentTaskHandling

      void setConcurrentTaskHandling(@NotNull @NotNull MaintenanceModeTask.ConcurrentTaskHandling concurrentTaskHandling)
      Defines if other tasks may be executed while the maintenance mode is active.
      Parameters:
      concurrentTaskHandling - the enum describing how concurrent tasks should be handled, must not be null.
      Since:
      5.2.516
    • getMaintenanceProjects

      @NotNull @NotNull List<Project> getMaintenanceProjects()
      All projects affected by the maintenance task.
      Returns:
      a list of all affected projects. May be empty but never null.
      Since:
      5.2.516
      See Also:
    • setMaintenanceProjects

      void setMaintenanceProjects(@NotNull @NotNull Collection<Project> projects)
      Specifies the projects which are affected by the maintenance task. Requires setting of setMaintenanceScope(MaintenanceScope) to MaintenanceModeTask.MaintenanceScope.PROJECT_LOCAL.
      Parameters:
      projects - All projects affected be the maintenance task. Must not be null.
      Since:
      5.2.516
      See Also:
    • getAllowedUsers

      @NotNull @NotNull List<User> getAllowedUsers()
      The server administrator may always connect to the server, even if the maintenance mode is active. This method returns all users who are also allowed to connect.
      Returns:
      a list of users who are allowed to connect despite an active maintenance mode. May be empty but never null.
      Since:
      5.2.516
      See Also:
    • setAllowedUsers

      void setAllowedUsers(@NotNull @NotNull Collection<User> allowedUsers)
      Specifies all users who are allowed to connect to the server even if the maintenance mode is active. The server administrator is added implicitly.
      Parameters:
      allowedUsers - all users who may connect despite an active maintenance mode. Must not be null.
      Since:
      5.2.516
      See Also:
    • getAllowedGroupNames

      @NotNull @NotNull List<String> getAllowedGroupNames()
      The server administrator may always connect to the server, even if the maintenance mode is active. This method returns the names of all groups who are also allowed to connect.
      Returns:
      a list of group names who are allowed to connect despite an active maintenance mode. May be empty but never null.
      Since:
      5.2.516
      See Also:
    • setAllowedGroupNames

      void setAllowedGroupNames(@NotNull @NotNull Collection<String> groupNames)
      Specifies the names of all groups who are allowed to connect to the server even if the maintenance mode is active.
      Parameters:
      groupNames - names of all groups who may connect despite an active maintenance mode. Must not be null.
      Since:
      5.2.516
      See Also: