Class MaintenanceProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.maintenance.MaintenanceProcessor
-
- All Implemented Interfaces:
GridComponent,GridProcessor,MaintenanceRegistry
public class MaintenanceProcessor extends GridProcessorAdapter implements MaintenanceRegistry
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description MaintenanceProcessor(GridKernalContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MaintenanceAction<?>>actionsForMaintenanceTask(String maintenanceTaskName)AllMaintenanceActions provided by a component forMaintenanceTaskwith a given name.@Nullable MaintenanceTaskactiveMaintenanceTask(String maitenanceTaskName)Returns activeMaintenanceTaskby its name.booleanisMaintenanceMode()voidprepareAndExecuteMaintenance()Examine all components if they need to execute maintenance actions.@Nullable MaintenanceTaskregisterMaintenanceTask(MaintenanceTask task)Method to registerMaintenanceTasklocally on the node where method is called.voidregisterMaintenanceTask(MaintenanceTask task, UnaryOperator<MaintenanceTask> remappingFunction)Method to registerMaintenanceTasklocally on the node where method is called.voidregisterWorkflowCallback(@NotNull String maintenanceTaskName, @NotNull MaintenanceWorkflowCallback cb)RegistersMaintenanceWorkflowCallbackfor aMaintenanceTaskwith a given name.@Nullable MaintenanceTaskrequestedTask(String maintenanceTaskName)voidstart()Starts grid component.voidstop(boolean cancel)Stops grid component.booleanunregisterMaintenanceTask(String maintenanceTaskName)DeletesMaintenanceTaskof given ID from maintenance registry.-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onKernalStop, onReconnected, printMemoryStats, toString, validateNode, validateNode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.maintenance.MaintenanceRegistry
registerWorkflowCallbackIfTaskExists
-
-
-
-
Constructor Detail
-
MaintenanceProcessor
public MaintenanceProcessor(GridKernalContext ctx)
- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
registerMaintenanceTask
@Nullable public @Nullable MaintenanceTask registerMaintenanceTask(MaintenanceTask task) throws IgniteCheckedException
Method to registerMaintenanceTasklocally on the node where method is called.For now it is not allowed to register new Maintenance Tasks in Maintenance Mode so this method should be called only when node operates normally. This may change in the future so it will become possible to create other maintenance tasks on node that is already entered Maintenance Mode.
When task is registered node continues to operate normally and will enter Maintenance Mode only after restart.
- Specified by:
registerMaintenanceTaskin interfaceMaintenanceRegistry- Parameters:
task-MaintenanceTaskobject with maintenance information that needs to be stored to maintenance registry.- Returns:
- Previously registered
MaintenanceTaskwith the same ID or null if no tasks were registered for this ID. - Throws:
IgniteCheckedException- If handling or storing maintenance task failed.
-
registerMaintenanceTask
public void registerMaintenanceTask(MaintenanceTask task, UnaryOperator<MaintenanceTask> remappingFunction) throws IgniteCheckedException
Method to registerMaintenanceTasklocally on the node where method is called. If an old task with the same name exists, applies remapping function to compute a new task. Has the same restrictions as theMaintenanceRegistry.registerMaintenanceTask(MaintenanceTask).- Specified by:
registerMaintenanceTaskin interfaceMaintenanceRegistry- Parameters:
task-MaintenanceTaskobject with maintenance information that needs to be stored to maintenance registry.remappingFunction- Function to compute a task if an oldMaintenanceTaskwith the same name exists.- Throws:
IgniteCheckedException- If handling or storing maintenance task failed.
-
stop
public void stop(boolean cancel) throws IgniteCheckedExceptionStops grid component.- Specified by:
stopin interfaceGridComponent- Overrides:
stopin classGridProcessorAdapter- Parameters:
cancel- Iftrue, then all ongoing tasks or jobs for relevant components need to be cancelled.- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
prepareAndExecuteMaintenance
public void prepareAndExecuteMaintenance()
Examine all components if they need to execute maintenance actions. As user may resolve some maintenance situations by hand when the node was turned off, component may find out that no maintenance is needed anymore.Maintenance tasksfor these components are removed and theirmaintenance actionsare not executed.- Specified by:
prepareAndExecuteMaintenancein interfaceMaintenanceRegistry
-
activeMaintenanceTask
@Nullable public @Nullable MaintenanceTask activeMaintenanceTask(String maitenanceTaskName)
Returns activeMaintenanceTaskby its name. There are active tasks only when node entered Maintenance Mode.MaintenanceTaskbecomes active when node enters Maintenance Mode and doesn't resolve the task during maintenance prepare phase.- Specified by:
activeMaintenanceTaskin interfaceMaintenanceRegistry- Parameters:
maitenanceTaskName- Maintenance Task name.- Returns:
MaintenanceTaskobject for given name or null if no maintenance task was found.
-
isMaintenanceMode
public boolean isMaintenanceMode()
- Specified by:
isMaintenanceModein interfaceMaintenanceRegistry- Returns:
Trueif any maintenance task was found.
-
unregisterMaintenanceTask
public boolean unregisterMaintenanceTask(String maintenanceTaskName)
DeletesMaintenanceTaskof given ID from maintenance registry.- Specified by:
unregisterMaintenanceTaskin interfaceMaintenanceRegistry- Parameters:
maintenanceTaskName- name ofMaintenanceTaskto be deleted.- Returns:
trueif existing task has been deleted.
-
registerWorkflowCallback
public void registerWorkflowCallback(@NotNull @NotNull String maintenanceTaskName, @NotNull @NotNull MaintenanceWorkflowCallback cb)RegistersMaintenanceWorkflowCallbackfor aMaintenanceTaskwith a given name. Component registeredMaintenanceTaskautomatically or by user request is responsible for providingMaintenanceRegistrywith an implementation ofMaintenanceWorkflowCallbackwhere registry obtainsMaintenanceActions to be executed for this task and does a preliminary check before starting maintenance.- Specified by:
registerWorkflowCallbackin interfaceMaintenanceRegistry- Parameters:
maintenanceTaskName- name ofMaintenanceTaskthis callback is registered for.cb-MaintenanceWorkflowCallbackinterface used by MaintenanceRegistry to execute maintenance steps by workflow.
-
actionsForMaintenanceTask
public List<MaintenanceAction<?>> actionsForMaintenanceTask(String maintenanceTaskName)
AllMaintenanceActions provided by a component forMaintenanceTaskwith a given name.- Specified by:
actionsForMaintenanceTaskin interfaceMaintenanceRegistry- Parameters:
maintenanceTaskName- name of Maintenance Task.- Returns:
Listof all availableMaintenanceActions for given Maintenance Task.
-
requestedTask
@Nullable public @Nullable MaintenanceTask requestedTask(String maintenanceTaskName)
- Specified by:
requestedTaskin interfaceMaintenanceRegistry- Parameters:
maintenanceTaskName- Task's name.- Returns:
- Requested maintenance task or
null.
-
-