Class CancelAllocationCommand

java.lang.Object
org.elasticsearch.cluster.routing.allocation.command.CancelAllocationCommand
All Implemented Interfaces:
AllocationCommand, NamedWriteable, Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class CancelAllocationCommand extends Object implements AllocationCommand
A command that cancels relocation, or recovery of a given shard on a node.
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • COMMAND_NAME_FIELD

      public static final org.elasticsearch.xcontent.ParseField COMMAND_NAME_FIELD
  • Constructor Details

    • CancelAllocationCommand

      public CancelAllocationCommand(String index, int shardId, String node, boolean allowPrimary)
      Parameters:
      index - index of the shard which allocation should be canceled
      shardId - id of the shard which allocation should be canceled
      node - id of the node that manages the shard which allocation should be canceled
    • CancelAllocationCommand

      public CancelAllocationCommand(StreamInput in) throws IOException
      Read from a stream.
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • name

      public String name()
      Description copied from interface: AllocationCommand
      Get the name of the command
      Specified by:
      name in interface AllocationCommand
      Returns:
      name of the command
    • index

      public 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 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 a RoutingAllocation setup
      Specified by:
      execute in interface AllocationCommand
      Parameters:
      allocation - RoutingAllocation to modify
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • fromXContent

      public static CancelAllocationCommand fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object