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 task-
Nested 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
-
Fields 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
-
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
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
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
public static final PersistentTasksCustomMetaData.Assignment INITIAL_ASSIGNMENT
-
-
Constructor Detail
-
PersistentTasksCustomMetaData
public PersistentTasksCustomMetaData(long lastAllocationId, java.util.Map<java.lang.String,PersistentTasksCustomMetaData.PersistentTask<?>> tasks)
-
PersistentTasksCustomMetaData
public PersistentTasksCustomMetaData(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getPersistentTasksCustomMetaData
public static PersistentTasksCustomMetaData getPersistentTasksCustomMetaData(ClusterState clusterState)
-
tasks
public java.util.Collection<PersistentTasksCustomMetaData.PersistentTask<?>> tasks()
-
taskMap
public java.util.Map<java.lang.String,PersistentTasksCustomMetaData.PersistentTask<?>> taskMap()
-
getTask
public PersistentTasksCustomMetaData.PersistentTask<?> getTask(java.lang.String id)
-
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
public Version getMinimalSupportedVersion()
Description copied from interface:VersionedNamedWriteable
The minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersion
in interfaceVersionedNamedWriteable
-
context
public java.util.EnumSet<MetaData.XContentContext> context()
- Specified by:
context
in interfaceMetaData.Custom
-
fromXContent
public static PersistentTasksCustomMetaData fromXContent(XContentParser parser)
-
getTaskWithId
public static <Params extends PersistentTaskParams> PersistentTasksCustomMetaData.PersistentTask<Params> getTaskWithId(ClusterState clusterState, java.lang.String taskId)
-
disassociateDeadNodes
public static ClusterState disassociateDeadNodes(ClusterState clusterState)
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
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
readDiffFrom
public static NamedDiff<MetaData.Custom> readDiffFrom(StreamInput in) throws java.io.IOException
- 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
public static PersistentTasksCustomMetaData.Builder builder()
-
builder
public static PersistentTasksCustomMetaData.Builder builder(PersistentTasksCustomMetaData tasks)
-
-