Class CancelAllocationCommand
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.command.CancelAllocationCommand
-
- All Implemented Interfaces:
AllocationCommand
,NamedWriteable
,Writeable
,ToXContent
,ToXContentObject
public class CancelAllocationCommand extends java.lang.Object implements AllocationCommand
A command that cancels relocation, or recovery of a given shard on a node.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.routing.allocation.command.AllocationCommand
AllocationCommand.Parser<T extends AllocationCommand>
-
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 ParseField
COMMAND_NAME_FIELD
static java.lang.String
NAME
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description CancelAllocationCommand(java.lang.String index, int shardId, java.lang.String node, boolean allowPrimary)
Creates a newCancelAllocationCommand
CancelAllocationCommand(StreamInput in)
Read from a stream.
-
Method Summary
Modifier and Type Method Description boolean
allowPrimary()
boolean
equals(java.lang.Object obj)
RerouteExplanation
execute(RoutingAllocation allocation, boolean explain)
Executes the command on aRoutingAllocation
setupstatic CancelAllocationCommand
fromXContent(XContentParser parser)
int
hashCode()
java.lang.String
index()
Get the index of the shard which allocation should be canceledjava.lang.String
name()
Get the name of the commandjava.lang.String
node()
Get the id of the node that manages the shard which allocation should be canceledint
shardId()
Get the id of the shard which allocation should be canceledXContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.cluster.routing.allocation.command.AllocationCommand
getMessage, getWriteableName
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
COMMAND_NAME_FIELD
public static final ParseField COMMAND_NAME_FIELD
-
-
Constructor Detail
-
CancelAllocationCommand
public CancelAllocationCommand(java.lang.String index, int shardId, java.lang.String node, boolean allowPrimary)
Creates a newCancelAllocationCommand
- Parameters:
index
- index of the shard which allocation should be canceledshardId
- id of the shard which allocation should be cancelednode
- id of the node that manages the shard which allocation should be canceled
-
CancelAllocationCommand
public CancelAllocationCommand(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
name
public java.lang.String name()
Description copied from interface:AllocationCommand
Get the name of the command- Specified by:
name
in interfaceAllocationCommand
- Returns:
- name of the command
-
index
public java.lang.String index()
Get the index of the shard which allocation should be canceled- Returns:
- index of the shard which allocation should be canceled
-
shardId
public int shardId()
Get the id of the shard which allocation should be canceled- Returns:
- id of the shard which allocation should be canceled
-
node
public java.lang.String node()
Get the id of the node that manages the shard which allocation should be canceled- Returns:
- id of the node that manages the shard which allocation should be canceled
-
allowPrimary
public boolean allowPrimary()
-
execute
public RerouteExplanation execute(RoutingAllocation allocation, boolean explain)
Description copied from interface:AllocationCommand
Executes the command on aRoutingAllocation
setup- Specified by:
execute
in interfaceAllocationCommand
- Parameters:
allocation
-RoutingAllocation
to modify
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContent
public static CancelAllocationCommand fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-