- All Implemented Interfaces:
- PeerStatisticComparator
public class RTTPeerStatisticComparator
extends Object
implements PeerStatisticComparator
A sample class class used by the routing mechanism to prioritise peers with
a low latency during routing.
First sorting criteria is bit distance measured in equal high-bits. Closer peers
are prioritised.
Second sorting criteria is the availability of RTT information. Peers with RTT
measurements are prioritised.
Third sorting criteria is the average RTT. Faster responding peers are prioritised.
The last tie-breaker is the complete XOR distance.
It is important to never let the comparator return 0 for non-equal peer addresses,
as this would conflict with the usage of the comparator in the TreeSet, where
the comparator returning 0 means that both entries are equal.
Created by Sebastian Stephan on 06.12.14.