Module org.elasticsearch.server
Package org.elasticsearch.persistent
Class PersistentTasksCustomMetadata
java.lang.Object
org.elasticsearch.cluster.AbstractNamedDiffable<Metadata.Custom>
org.elasticsearch.persistent.PersistentTasksCustomMetadata
- All Implemented Interfaces:
Diffable<Metadata.Custom>,Metadata.Custom,NamedDiffable<Metadata.Custom>,NamedWriteable,VersionedNamedWriteable,Writeable,ChunkedToXContent
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 ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classA record that represents a single running persistent taskNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PersistentTasksCustomMetadata.Assignmentstatic final StringFields inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionPersistentTasksCustomMetadata(long lastAllocationId, Map<String, PersistentTasksCustomMetadata.PersistentTask<?>> tasks) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()context()static ClusterStatedisassociateDeadNodes(ClusterState clusterState) Unassign any persistent tasks executing on nodes that are no longer in the cluster.booleanfindTasks(String taskName, Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate) fromXContent(XContentParser parser) The minimal version of the recipient this object can be sent tolonggetNumberOfTasksOnNode(String nodeId, String taskName) getPersistentTasksCustomMetadata(ClusterState clusterState) static <Params extends PersistentTaskParams>
PersistentTasksCustomMetadata.PersistentTask<Params> getTaskWithId(ClusterState clusterState, String taskId) Returns the name of the writeable objectinthashCode()static NamedDiff<Metadata.Custom> taskMap()tasks()toString()Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params ignored) Create an iterator ofToXContentchunks for a REST response.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.common.xcontent.ChunkedToXContent
isFragment, toXContentChunked, toXContentChunkedV8Methods inherited from interface org.elasticsearch.cluster.metadata.Metadata.Custom
isRestorable
-
Field Details
-
TYPE
- See Also:
-
ASSIGNMENT_PARSER
public static final ConstructingObjectParser<PersistentTasksCustomMetadata.Assignment,Void> ASSIGNMENT_PARSER -
INITIAL_ASSIGNMENT
-
-
Constructor Details
-
PersistentTasksCustomMetadata
public PersistentTasksCustomMetadata(long lastAllocationId, Map<String, PersistentTasksCustomMetadata.PersistentTask<?>> tasks) -
PersistentTasksCustomMetadata
- Throws:
IOException
-
-
Method Details
-
getPersistentTasksCustomMetadata
public static PersistentTasksCustomMetadata getPersistentTasksCustomMetadata(ClusterState clusterState) -
tasks
-
taskMap
-
getTask
-
findTasks
public Collection<PersistentTasksCustomMetadata.PersistentTask<?>> findTasks(String taskName, Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate) -
equals
-
hashCode
public int hashCode() -
toString
-
getNumberOfTasksOnNode
-
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, 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
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.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
readDiffFrom
- Throws:
IOException
-
toXContentChunked
Description copied from interface:ChunkedToXContentCreate an iterator ofToXContentchunks for a REST response. Each chunk is serialized with the sameXContentBuilderandToXContent.Params, which is also the same as theToXContent.Paramspassed as theparamsargument. For best results, all chunks should beO(1)size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelperfor some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Specified by:
toXContentChunkedin interfaceChunkedToXContent- Returns:
- iterator over chunks of
ToXContent
-
builder
-
builder
-