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 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
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.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 org.elasticsearch.common.xcontent.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
Modifier and Type Method Description static PersistentTasksCustomMetadata.Builder
builder()
static PersistentTasksCustomMetadata.Builder
builder(PersistentTasksCustomMetadata tasks)
java.util.EnumSet<Metadata.XContentContext>
context()
static ClusterState
disassociateDeadNodes(ClusterState clusterState)
Unassign any persistent tasks executing on nodes that are no longer in the cluster.boolean
equals(java.lang.Object o)
java.util.Collection<PersistentTasksCustomMetadata.PersistentTask<?>>
findTasks(java.lang.String taskName, java.util.function.Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate)
static PersistentTasksCustomMetadata
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
Version
getMinimalSupportedVersion()
The minimal version of the recipient this object can be sent tolong
getNumberOfTasksOnNode(java.lang.String nodeId, java.lang.String taskName)
static PersistentTasksCustomMetadata
getPersistentTasksCustomMetadata(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.String
getWriteableName()
Returns the name of the writeable objectint
hashCode()
static NamedDiff<Metadata.Custom>
readDiffFrom(StreamInput in)
java.util.Map<java.lang.String,PersistentTasksCustomMetadata.PersistentTask<?>>
taskMap()
java.util.Collection<PersistentTasksCustomMetadata.PersistentTask<?>>
tasks()
java.lang.String
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.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 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:
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
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
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 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:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
java.io.IOException
-
builder
-
builder
-