Package org.elasticsearch.persistent
Class PersistentTasksCustomMetadata
java.lang.Object
org.elasticsearch.cluster.AbstractNamedDiffable<Metadata.Custom>
org.elasticsearch.persistent.PersistentTasksCustomMetadata
- All Implemented Interfaces:
ClusterState.FeatureAware,Diffable<Metadata.Custom>,Metadata.Custom,NamedDiffable<Metadata.Custom>,NamedWriteable,VersionedNamedWriteable,Writeable,ToXContent,ToXContentFragment
public final class PersistentTasksCustomMetadata extends AbstractNamedDiffable<Metadata.Custom> implements Metadata.Custom
A cluster state record that contains a list of all running persistent tasks
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPersistentTasksCustomMetadata.Assignmentstatic classPersistentTasksCustomMetadata.Builderstatic classPersistentTasksCustomMetadata.PersistentTask<P extends PersistentTaskParams>A record that represents a single running persistent taskNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields Modifier and Type Field Description static ConstructingObjectParser<PersistentTasksCustomMetadata.Assignment,java.lang.Void>ASSIGNMENT_PARSERstatic PersistentTasksCustomMetadata.AssignmentINITIAL_ASSIGNMENTstatic java.lang.StringTYPE -
Constructor Summary
Constructors Constructor Description PersistentTasksCustomMetadata(long lastAllocationId, java.util.Map<java.lang.String,PersistentTasksCustomMetadata.PersistentTask<?>> tasks)PersistentTasksCustomMetadata(StreamInput in) -
Method Summary
Methods inherited from class org.elasticsearch.cluster.AbstractNamedDiffable
diff, get, readDiffFromMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.ClusterState.FeatureAware
getRequiredFeature
-
Field Details
-
TYPE
public static final java.lang.String TYPE- See Also:
- Constant Field Values
-
ASSIGNMENT_PARSER
public static final ConstructingObjectParser<PersistentTasksCustomMetadata.Assignment,java.lang.Void> ASSIGNMENT_PARSER -
INITIAL_ASSIGNMENT
-
-
Constructor Details
-
PersistentTasksCustomMetadata
public PersistentTasksCustomMetadata(long lastAllocationId, java.util.Map<java.lang.String,PersistentTasksCustomMetadata.PersistentTask<?>> tasks) -
PersistentTasksCustomMetadata
- Throws:
java.io.IOException
-
-
Method Details
-
getPersistentTasksCustomMetadata
public static PersistentTasksCustomMetadata getPersistentTasksCustomMetadata(ClusterState clusterState) -
tasks
-
taskMap
-
getTask
-
findTasks
public java.util.Collection<PersistentTasksCustomMetadata.PersistentTask<?>> findTasks(java.lang.String taskName, java.util.function.Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate) -
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getNumberOfTasksOnNode
public long getNumberOfTasksOnNode(java.lang.String nodeId, java.lang.String taskName) -
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteableThe minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersionin interfaceVersionedNamedWriteable
-
context
- Specified by:
contextin interfaceMetadata.Custom
-
fromXContent
-
getTaskWithId
public static <Params extends PersistentTaskParams> PersistentTasksCustomMetadata.PersistentTask<Params> getTaskWithId(ClusterState clusterState, java.lang.String taskId) -
disassociateDeadNodes
Unassign any persistent tasks executing on nodes that are no longer in the cluster. If the task's assigment has a non-null executor node and that node is no longer in the cluster then the assignment is set toLOST_NODE_ASSIGNMENT- Parameters:
clusterState- The clusterstate- Returns:
- If no changes the argument
clusterStateis returned else a copy with the modified tasks
-
getWriteableName
public java.lang.String getWriteableName()Description copied from interface:VersionedNamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein interfaceVersionedNamedWriteable
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
readDiffFrom
- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
builder
-
builder
-