/** * Gets the current ranking of the node to which the shard is currently assigned, relative to the * other nodes in the cluster as reported in {@link NodeAllocationResult#getWeightRanking()}. The * ranking will only return a meaningful positive integer if {@link #getClusterRebalanceDecision()} returns * a non-null value; otherwise, 0 will be returned. If {@link #isDecisionTaken()} returns * {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public int getCurrentNodeRanking() { checkDecisionState(); return currentNodeRanking; }
/** * Returns the decision for the shard being allowed to remain on its current node. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public Decision getCanRemainDecision() { checkDecisionState(); return canRemainDecision; }
/** * Returns {@code true} if the shard cannot remain on its current node and can be moved, * returns {@code false} otherwise. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public boolean forceMove() { checkDecisionState(); return canRemain() == false && allocationDecision == AllocationDecision.YES; }
/** * Returns the decision for being allowed to rebalance the shard. Invoking this method will return * {@code null} if {@link #canRemain()} ()} returns {@code false}, which means the node is not allowed to * remain on its current node, so the cluster is forced to attempt to move the shard to a different node, * as opposed to attempting to rebalance the shard if a better cluster balance is possible by moving it. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will throw an * {@code IllegalStateException}. */ @Nullable public Decision getClusterRebalanceDecision() { checkDecisionState(); return clusterRebalanceDecision; }
/** * Returns {@code true} if the shard can remain on its current node, returns {@code false} otherwise. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public boolean canRemain() { checkDecisionState(); return canRemainDecision.type() == Type.YES; }
/** * Returns {@code true} if the shard is allowed to be rebalanced to another node in the cluster, * returns {@code false} otherwise. If {@link #getClusterRebalanceDecision()} returns {@code null}, then * the result of this method is meaningless, as no rebalance decision was taken. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public boolean canRebalanceCluster() { checkDecisionState(); return clusterRebalanceDecision != null && clusterRebalanceDecision.type() == Type.YES; }
/** * Gets the current ranking of the node to which the shard is currently assigned, relative to the * other nodes in the cluster as reported in {@link NodeAllocationResult#getWeightRanking()}. The * ranking will only return a meaningful positive integer if {@link #getClusterRebalanceDecision()} returns * a non-null value; otherwise, 0 will be returned. If {@link #isDecisionTaken()} returns * {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public int getCurrentNodeRanking() { checkDecisionState(); return currentNodeRanking; }
/** * Returns the decision for the shard being allowed to remain on its current node. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public Decision getCanRemainDecision() { checkDecisionState(); return canRemainDecision; }
/** * Gets the current ranking of the node to which the shard is currently assigned, relative to the * other nodes in the cluster as reported in {@link NodeAllocationResult#getWeightRanking()}. The * ranking will only return a meaningful positive integer if {@link #getClusterRebalanceDecision()} returns * a non-null value; otherwise, 0 will be returned. If {@link #isDecisionTaken()} returns * {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public int getCurrentNodeRanking() { checkDecisionState(); return currentNodeRanking; }
/** * Gets the current ranking of the node to which the shard is currently assigned, relative to the * other nodes in the cluster as reported in {@link NodeAllocationResult#getWeightRanking()}. The * ranking will only return a meaningful positive integer if {@link #getClusterRebalanceDecision()} returns * a non-null value; otherwise, 0 will be returned. If {@link #isDecisionTaken()} returns * {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public int getCurrentNodeRanking() { checkDecisionState(); return currentNodeRanking; }
/** * Returns the decision for the shard being allowed to remain on its current node. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public Decision getCanRemainDecision() { checkDecisionState(); return canRemainDecision; }
/** * Returns the decision for the shard being allowed to remain on its current node. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public Decision getCanRemainDecision() { checkDecisionState(); return canRemainDecision; }
@Override public String getExplanation() { checkDecisionState(); String explanation; if (clusterRebalanceDecision != null) {
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { checkDecisionState(); if (targetNode != null) { builder.startObject("target_node");
/** * Returns {@code true} if the shard is allowed to be rebalanced to another node in the cluster, * returns {@code false} otherwise. If {@link #getClusterRebalanceDecision()} returns {@code null}, then * the result of this method is meaningless, as no rebalance decision was taken. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public boolean canRebalanceCluster() { checkDecisionState(); return clusterRebalanceDecision != null && clusterRebalanceDecision.type() == Type.YES; }
/** * Returns {@code true} if the shard is allowed to be rebalanced to another node in the cluster, * returns {@code false} otherwise. If {@link #getClusterRebalanceDecision()} returns {@code null}, then * the result of this method is meaningless, as no rebalance decision was taken. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public boolean canRebalanceCluster() { checkDecisionState(); return clusterRebalanceDecision != null && clusterRebalanceDecision.type() == Type.YES; }
/** * Returns the decision for being allowed to rebalance the shard. Invoking this method will return * {@code null} if {@link #canRemain()} ()} returns {@code false}, which means the node is not allowed to * remain on its current node, so the cluster is forced to attempt to move the shard to a different node, * as opposed to attempting to rebalance the shard if a better cluster balance is possible by moving it. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will throw an * {@code IllegalStateException}. */ @Nullable public Decision getClusterRebalanceDecision() { checkDecisionState(); return clusterRebalanceDecision; }
/** * Returns the decision for being allowed to rebalance the shard. Invoking this method will return * {@code null} if {@link #canRemain()} ()} returns {@code false}, which means the node is not allowed to * remain on its current node, so the cluster is forced to attempt to move the shard to a different node, * as opposed to attempting to rebalance the shard if a better cluster balance is possible by moving it. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will throw an * {@code IllegalStateException}. */ @Nullable public Decision getClusterRebalanceDecision() { checkDecisionState(); return clusterRebalanceDecision; }
/** * Returns {@code true} if the shard cannot remain on its current node and can be moved, * returns {@code false} otherwise. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public boolean forceMove() { checkDecisionState(); return canRemain() == false && allocationDecision == AllocationDecision.YES; }
/** * Returns {@code true} if the shard can remain on its current node, returns {@code false} otherwise. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ public boolean canRemain() { checkDecisionState(); return canRemainDecision.type() == Type.YES; }