Class ShardAllocationDecision
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.ShardAllocationDecision
-
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
public final class ShardAllocationDecision extends java.lang.Object implements ToXContentFragment, Writeable
Represents the decision taken for the allocation of a single shard. If the shard is unassigned,getAllocateDecision()
will return an object containing the decision and its explanation, andgetMoveDecision()
will return an object for whichMoveDecision.isDecisionTaken()
returnsfalse
. If the shard is in the started state, thengetMoveDecision()
will return an object containing the decision to move/rebalance the shard, andgetAllocateDecision()
will return an object for whichAllocateUnassignedDecision.isDecisionTaken()
returnsfalse
. If the shard is neither unassigned nor started (i.e. it is initializing or relocating), then bothgetAllocateDecision()
andgetMoveDecision()
will return objects whoseisDecisionTaken()
method returnsfalse
.
-
-
Nested Class Summary
-
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 ShardAllocationDecision
NOT_TAKEN
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description ShardAllocationDecision(AllocateUnassignedDecision allocateDecision, MoveDecision moveDecision)
ShardAllocationDecision(StreamInput in)
-
Method Summary
Modifier and Type Method Description AllocateUnassignedDecision
getAllocateDecision()
Gets the unassigned allocation decision for the shard.MoveDecision
getMoveDecision()
Gets the move decision for the shard.boolean
isDecisionTaken()
Returnstrue
if either an allocation decision or a move decision was taken for the shard.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
NOT_TAKEN
public static final ShardAllocationDecision NOT_TAKEN
-
-
Constructor Detail
-
ShardAllocationDecision
public ShardAllocationDecision(AllocateUnassignedDecision allocateDecision, MoveDecision moveDecision)
-
ShardAllocationDecision
public ShardAllocationDecision(StreamInput in) throws java.io.IOException
- 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.
-
isDecisionTaken
public boolean isDecisionTaken()
Returnstrue
if either an allocation decision or a move decision was taken for the shard. If no decision was taken, as in the case of initializing or relocating shards, then this method returnsfalse
.
-
getAllocateDecision
public AllocateUnassignedDecision getAllocateDecision()
Gets the unassigned allocation decision for the shard. If the shard was not in the unassigned state, the instance ofAllocateUnassignedDecision
that is returned will haveAllocateUnassignedDecision.isDecisionTaken()
returnfalse
.
-
getMoveDecision
public MoveDecision getMoveDecision()
Gets the move decision for the shard. If the shard was not in the started state, the instance ofMoveDecision
that is returned will haveMoveDecision.isDecisionTaken()
returnfalse
.
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
-