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 class
PersistentTasksCustomMetadata.Assignment
static class
PersistentTasksCustomMetadata.Builder
static class
PersistentTasksCustomMetadata.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.Params
Nested 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_PARSER
static PersistentTasksCustomMetadata.Assignment
INITIAL_ASSIGNMENT
static java.lang.String
TYPE
-
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, readDiffFrom
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getNumberOfTasksOnNode
public long getNumberOfTasksOnNode(java.lang.String nodeId, java.lang.String taskName) -
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteable
The minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersion
in interfaceVersionedNamedWriteable
-
context
- Specified by:
context
in 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
clusterState
is returned else a copy with the modified tasks
-
getWriteableName
public java.lang.String getWriteableName()Description copied from interface:VersionedNamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
- Specified by:
getWriteableName
in interfaceVersionedNamedWriteable
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
readDiffFrom
- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
builder
-
builder
-