org.gcube.common.clients.delegates
Class DiscoveryDelegate<A,S>

java.lang.Object
  extended by org.gcube.common.clients.delegates.AbstractDelegate<A,S,DiscoveryConfig<A,S>>
      extended by org.gcube.common.clients.delegates.DiscoveryDelegate<A,S>
Type Parameters:
A - the type of service addresses
All Implemented Interfaces:
ProxyDelegate<S>

public class DiscoveryDelegate<A,S>
extends AbstractDelegate<A,S,DiscoveryConfig<A,S>>

A ProxyDelegate that discovers service endpoints.

The delegates attempt to make Calls to endpoints cached in an EndpointCache. If the calls fail, or the cache is empty, they execute a Query for endpoints and call the results in turn until the call succeeds or there are no more endpoints to call. If the call succeeds with one endpoint, the delegates cache the endpoint in the EndpointCache.

Author:
Fabio Simeoni
See Also:
Query, EndpointCache

Constructor Summary
DiscoveryDelegate(DiscoveryConfig<A,S> config)
          Creates an instance with a ProxyPlugin, a Query, and an EndpointCache.
 
Method Summary
<V> V
make(Call<S,V> call)
          Makes a Call to a given service endpoint.
 
Methods inherited from class org.gcube.common.clients.delegates.AbstractDelegate
config, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiscoveryDelegate

public DiscoveryDelegate(DiscoveryConfig<A,S> config)
Creates an instance with a ProxyPlugin, a Query, and an EndpointCache.

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

make

public <V> V make(Call<S,V> call)
       throws Exception
Description copied from interface: ProxyDelegate
Makes a Call to a given service endpoint.

Type Parameters:
V - 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 © 2013. All Rights Reserved.