Interface MaintenanceModeTask
- All Superinterfaces:
ScheduleTask
A task of this type puts the server into maintenance mode after a customizable
period of time. It consists of various
Use
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
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Describes if other tasks may be executed while the maintenance mode is active.static enum
When the maintenance mode starts, existing sessions may be quit or kept alive.static enum
The maintenance mode may only affect certain projects or the whole FirstSpirit server.static enum
A maintenance mode task consists of up to five stages, from an initial preparation period up to activating the actual maintenance mode.static enum
The notification that a maintenance is imminent may be displayed to the users in different ways. -
Method Summary
Modifier and TypeMethodDescriptionThe server administrator may always connect to the server, even if the maintenance mode is active.The server administrator may always connect to the server, even if the maintenance mode is active.Indicates if other tasks may be executed while the maintenance mode is active.@NotNull MaintenanceModeTask.DisconnectMode
Indicates the handling of existing sessions once the stageMaintenanceModeTask.MaintenanceStage.MAINTENANCE_MODE_ACTIVE
begins.long
getDurationOfStage
(@NotNull MaintenanceModeTask.MaintenanceStage stage) Each stage has a duration after which the next stage is started.@NotNull String
The descriptive name of the maintenance mode started by this task.All projects affected by the maintenance task.@NotNull MaintenanceModeTask.MaintenanceScope
Indicates the scope of this maintenance task, i.e. if only certain projects or the whole server is affected.@NotNull String
The message which is displayed to all users once the task has been started.Indicates how the message is displayed to the users.void
setAllowedGroupNames
(@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.void
setAllowedUsers
(@NotNull Collection<User> allowedUsers) Specifies all users who are allowed to connect to the server even if the maintenance mode is active.void
setConcurrentTaskHandling
(@NotNull MaintenanceModeTask.ConcurrentTaskHandling concurrentTaskHandling) Defines if other tasks may be executed while the maintenance mode is active.void
setDisconnectMode
(@NotNull MaintenanceModeTask.DisconnectMode disconnectMode) Defines how existing sessions are handled once the stageMaintenanceModeTask.MaintenanceStage.MAINTENANCE_MODE_ACTIVE
begins.void
setDurationOfStage
(long durationInMilliseconds, @NotNull MaintenanceModeTask.MaintenanceStage stage) Each stage has a duration after which the next stage is started.void
setMaintenanceName
(@NotNull String name) Set descriptive name of the maintenance mode started by this task.void
setMaintenanceProjects
(@NotNull Collection<Project> projects) Specifies the projects which are affected by the maintenance task.void
setMaintenanceScope
(@NotNull MaintenanceModeTask.MaintenanceScope maintenanceScope) Defines the scope of this maintenance task.void
setMessage
(@NotNull String message) Set the message which is included in all messages regarding this maintenance task.void
setMessageDisplayType
(@NotNull MaintenanceModeTask.MessageDisplayType messageDisplayType) Define how the message of this task should be displayed to the users.Methods inherited from interface de.espirit.firstspirit.access.schedule.ScheduleTask
checkParams, getClusterNodeName, getDescription, getExecuteInFault, getExecuteParallel, getName, getRemoteTaskType, getScheduleEntry, getTemplate, hasTemplate, isActive, isExecuteOnClusterNode, isProjectTask, setActive, setClusterNodeName, setDescription, setExecuteInFault, setExecuteOnClusterNode, setExecuteParallel, setName, setTemplate, test
-
Method Details
-
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
Set descriptive name of the maintenance mode started by this task.- Parameters:
name
- the name to set, must not benull
.- Since:
- 5.2.518, 5.2.605
-
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
Set the message which is included in all messages regarding this maintenance task.- Parameters:
message
- the message to display, must not benull
.- Since:
- 5.2.516
-
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 benull
.- Since:
- 5.2.516
-
getDurationOfStage
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 benull
.- 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 benull
.- Throws:
IllegalArgumentException
- if an unknown stage has been specified or the duration is negative.- Since:
- 5.2.516
- See Also:
-
getDisconnectMode
Indicates the handling of existing sessions once the stageMaintenanceModeTask.MaintenanceStage.MAINTENANCE_MODE_ACTIVE
begins.- Returns:
- The disconnect mode, never
null
. Default isKEEP_SESSIONS_ALIVE
- Since:
- 5.2.516
-
setDisconnectMode
Defines how existing sessions are handled once the stageMaintenanceModeTask.MaintenanceStage.MAINTENANCE_MODE_ACTIVE
begins.- Parameters:
disconnectMode
- The disconnect mode, must not benull
.- Since:
- 5.2.516
-
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 isGLOBAL
- Since:
- 5.2.516
-
setMaintenanceScope
Defines the scope of this maintenance task.- Parameters:
maintenanceScope
- the maintenance scope, must not benull
.- Since:
- 5.2.516
-
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 isALLOW_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 benull
.- Since:
- 5.2.516
-
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
Specifies the projects which are affected by the maintenance task. Requires setting ofsetMaintenanceScope(MaintenanceScope)
toMaintenanceModeTask.MaintenanceScope.PROJECT_LOCAL
.- Parameters:
projects
- All projects affected be the maintenance task. Must not benull
.- Since:
- 5.2.516
- See Also:
-
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
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 benull
.- Since:
- 5.2.516
- See Also:
-
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
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 benull
.- Since:
- 5.2.516
- See Also:
-