public final class AbstractClientProvider.RandomEndpointStrategy extends Object implements AbstractClientProvider.EndpointStrategy
Constructor and Description |
---|
AbstractClientProvider.RandomEndpointStrategy(Iterable<org.apache.twill.discovery.Discoverable> endpoints)
Constructs a random endpoint strategy.
|
public AbstractClientProvider.RandomEndpointStrategy(Iterable<org.apache.twill.discovery.Discoverable> endpoints)
endpoints
- Endpoints for the strategy to use. Note that this strategy will
invoke Iterable.iterator()
and traverse through it on
every call to the pick()
method. One could leverage this
behavior with the live Iterable
as provided by
DiscoveryServiceClient.discover(String)
method.public org.apache.twill.discovery.Discoverable pick()
AbstractClientProvider.EndpointStrategy
Discoverable
using its strategy.pick
in interface AbstractClientProvider.EndpointStrategy
Discoverable
based on the stragegy or null
if no endpoint can be found.Copyright © 2016 The Apache Software Foundation. All rights reserved.