Interface ReplicaSelector (6.116.0)

public interface ReplicaSelector

Interface for selecting a replica from a list of candidates.

Methods

select(List<ChannelEndpoint> candidates, Function<ChannelEndpoint,Double> scoreLookup)

public abstract ChannelEndpoint select(List<ChannelEndpoint> candidates, Function<ChannelEndpoint,Double> scoreLookup)

Selects a replica from the given list of candidates.

Parameters
Name Description
candidates List<ChannelEndpoint>

the list of eligible candidates.

scoreLookup Function<ChannelEndpoint,Double>

a function to look up the latency score for a candidate.

Returns
Type Description
ChannelEndpoint

the selected candidate, or null if the list is empty.