Module org.elasticsearch.server
Class ReservedStateUpdateTask
java.lang.Object
org.elasticsearch.reservedstate.service.ReservedStateUpdateTask
- All Implemented Interfaces:
ClusterStateTaskListener
Generic task to update and reserve parts of the cluster state
Reserved cluster state can only be modified by using the ReservedClusterStateService
. Updating
the reserved cluster state through REST APIs is not permitted.
-
Constructor Summary
ConstructorsConstructorDescriptionReservedStateUpdateTask
(String namespace, ReservedStateChunk stateChunk, ReservedStateVersionCheck versionCheck, Map<String, ReservedClusterStateHandler<?>> handlers, Collection<String> orderedHandlers, Consumer<org.elasticsearch.reservedstate.service.ErrorState> errorReporter, ActionListener<ActionResponse.Empty> listener) -
Method Summary
Modifier and TypeMethodDescriptionprotected ClusterState
execute
(ClusterState currentState) void
A callback for when task execution fails.
-
Constructor Details
-
ReservedStateUpdateTask
public ReservedStateUpdateTask(String namespace, ReservedStateChunk stateChunk, ReservedStateVersionCheck versionCheck, Map<String, ReservedClusterStateHandler<?>> handlers, Collection<String> orderedHandlers, Consumer<org.elasticsearch.reservedstate.service.ErrorState> errorReporter, ActionListener<ActionResponse.Empty> listener)
-
-
Method Details
-
onFailure
Description copied from interface:ClusterStateTaskListener
A callback for when task execution fails. May receive aNotMasterException
if this node stopped being the master before this task was executed or aProcessClusterEventTimeoutException
if the task timed out before it was executed. If the task fails during execution then this method receives the corresponding exception. If the task executes successfully but the resulting cluster state publication fails then this method receives aFailedToCommitClusterStateException
. If publication fails then a new master is elected and the update might or might not take effect, depending on whether or not the newly-elected master accepted the published state that failed to be committed.Use
MasterService.isPublishFailureException(java.lang.Exception)
to detect the "expected" master failure cases if needed.Implementations of this callback must not throw exceptions: an exception thrown here is logged by the master service at
ERROR
level and otherwise ignored, except in tests where it raises anAssertionError
. If log-and-ignore is the right behaviour then implementations must do so themselves, typically using a more specific logger and at a less dramatic log level.- Specified by:
onFailure
in interfaceClusterStateTaskListener
-
execute
-