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,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.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
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.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 org.elasticsearch.common.xcontent.ConstructingObjectParser<PersistentTasksCustomMetadata.Assignment,java.lang.Void>ASSIGNMENT_PARSERstatic PersistentTasksCustomMetadata.AssignmentINITIAL_ASSIGNMENTstatic java.lang.StringTYPEFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors Constructor Description PersistentTasksCustomMetadata(long lastAllocationId, java.util.Map<java.lang.String,PersistentTasksCustomMetadata.PersistentTask<?>> tasks)PersistentTasksCustomMetadata(StreamInput in) -
Method Summary
Modifier and Type Method Description static PersistentTasksCustomMetadata.Builderbuilder()static PersistentTasksCustomMetadata.Builderbuilder(PersistentTasksCustomMetadata tasks)java.util.EnumSet<Metadata.XContentContext>context()static ClusterStatedisassociateDeadNodes(ClusterState clusterState)Unassign any persistent tasks executing on nodes that are no longer in the cluster.booleanequals(java.lang.Object o)java.util.Collection<PersistentTasksCustomMetadata.PersistentTask<?>>findTasks(java.lang.String taskName, java.util.function.Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate)static PersistentTasksCustomMetadatafromXContent(org.elasticsearch.common.xcontent.XContentParser parser)VersiongetMinimalSupportedVersion()The minimal version of the recipient this object can be sent tolonggetNumberOfTasksOnNode(java.lang.String nodeId, java.lang.String taskName)static PersistentTasksCustomMetadatagetPersistentTasksCustomMetadata(ClusterState clusterState)PersistentTasksCustomMetadata.PersistentTask<?>getTask(java.lang.String id)static <Params extends PersistentTaskParams>
PersistentTasksCustomMetadata.PersistentTask<Params>getTaskWithId(ClusterState clusterState, java.lang.String taskId)java.lang.StringgetWriteableName()Returns the name of the writeable objectinthashCode()static NamedDiff<Metadata.Custom>readDiffFrom(StreamInput in)java.util.Map<java.lang.String,PersistentTasksCustomMetadata.PersistentTask<?>>taskMap()java.util.Collection<PersistentTasksCustomMetadata.PersistentTask<?>>tasks()java.lang.StringtoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.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
getRequiredFeatureMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
TYPE
public static final java.lang.String TYPE- See Also:
- Constant Field Values
-
ASSIGNMENT_PARSER
public static final org.elasticsearch.common.xcontent.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
public static PersistentTasksCustomMetadata fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) -
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 org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
builder
-
builder
-