Package org.elasticsearch.gateway
Class PriorityComparator
- java.lang.Object
-
- org.elasticsearch.gateway.PriorityComparator
-
- All Implemented Interfaces:
Comparator<ShardRouting>
public abstract class PriorityComparator extends Object implements Comparator<ShardRouting>
A comparator that compares ShardRouting based on it's indexes priority (index.priority), it's creation date (index.creation_date), or eventually by it's index name in reverse order. We try to recover first shards from an index with the highest priority, if that's the same we try to compare the timestamp the index is created and pick the newer first (time-based indices, here the newer indices matter more). If even that is the same, we compare the index name which is useful if the date is baked into the index name. ie logstash-2015.05.03.
-
-
Constructor Summary
Constructors Constructor Description PriorityComparator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompare(ShardRouting o1, ShardRouting o2)static PriorityComparatorgetAllocationComparator(RoutingAllocation allocation)Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.protected abstract SettingsgetIndexSettings(Index index)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
compare
public final int compare(ShardRouting o1, ShardRouting o2)
- Specified by:
comparein interfaceComparator<ShardRouting>
-
getAllocationComparator
public static PriorityComparator getAllocationComparator(RoutingAllocation allocation)
Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.
-
-