org.gcube.common.clients
Class DiscoveryClient<S,E>

java.lang.Object
  extended by org.gcube.common.clients.DiscoveryClient<S,E>
Type Parameters:
S - the type of the services
E - the type of the service endpoints
All Implemented Interfaces:
Client<S>

public class DiscoveryClient<S,E>
extends Object
implements Client<S>

A Client that discovers the services with which it interacts.

Discovery clients relies on a Query to discover services. They then interact with all the services they discover until they succeed with one. Finally, they cache the endpoint of this service and use it first for subsequent interactions.

Note that discovery clients abandon their best-effort strategy when Calls or individual failures are marked with Unrecoverable.

Author:
Fabio Simeoni
See Also:
Query, Unrecoverable

Constructor Summary
DiscoveryClient(ServiceProvider<S,E> provider, Query<E> query, EndpointCache<E> cache)
          Creates an instance with a ServiceProvider, a Query, and an EndpointCache.
 
Method Summary
<CR> CR
make(Call<S,CR> call)
          Makes a Call to the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveryClient

public DiscoveryClient(ServiceProvider<S,E> provider,
                       Query<E> query,
                       EndpointCache<E> cache)
Creates an instance with a ServiceProvider, a Query, and an EndpointCache.

Parameters:
provider - the provider
query - the query
cache - the cache
Method Detail

make

public <CR> CR make(Call<S,CR> call)
        throws Exception
Description copied from interface: Client
Makes a Call to the service.

Specified by:
make in interface Client<S>
Type Parameters:
CR - the type of the value returned from the call
Parameters:
call - the call
Returns:
the value returned from the call
Throws:
Exception - if the call fails


Copyright © 2012. All Rights Reserved.