Package org.elasticsearch.gateway
Class PriorityComparator
java.lang.Object
org.elasticsearch.gateway.PriorityComparator
- All Implemented Interfaces:
java.util.Comparator<ShardRouting>
public abstract class PriorityComparator extends java.lang.Object implements java.util.Comparator<ShardRouting>
A comparator that compares
ShardRouting
instances based on various properties. Instances
are ordered as follows.
- First, system indices are ordered before non-system indices
- Then indices are ordered by their priority, in descending order (index.priority)
- Then newer indices are ordered before older indices, based on their creation date. This benefits time-series indices, where newer indices are considered more urgent (index.creation_date)
- Lastly the index names are compared, which is useful when a date is baked into the index
name, e.g.
logstash-2015.05.03
-
Constructor Summary
Constructors Constructor Description PriorityComparator()
-
Method Summary
Modifier and Type Method Description int
compare(ShardRouting o1, ShardRouting o2)
static PriorityComparator
getAllocationComparator(RoutingAllocation allocation)
Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.protected abstract IndexMetadata
getMetadata(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
-
Constructor Details
-
PriorityComparator
public PriorityComparator()
-
-
Method Details
-
compare
- Specified by:
compare
in interfacejava.util.Comparator<ShardRouting>
-
getMetadata
-
getAllocationComparator
Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.
-