SMILA 1.0 API documentation

org.eclipse.smila.http.client.impl.failover
Class FailoverRestClient

java.lang.Object
  extended by org.eclipse.smila.http.client.impl.base.RestClientBase
      extended by org.eclipse.smila.http.client.impl.failover.FailoverRestClient
All Implemented Interfaces:
RestClient

public class FailoverRestClient
extends RestClientBase

Alternative RestClient implementation that supports talking to a cluster of SMILA services and can do failover to another node if the current node is not reachable anymore. Create the client with a list of "host:port" strings. The client will talk to the first of those nodes as long as it is reachable. Then it will failover to the second node. It will not switch back to the first node if it becomes available again. It will also not distribute request to available nodes to provide load-balancing. Restriction: if the request contains an InputStream to provide request content, then the request cannot be retried on another node if the InputStream has been already read during the last failed attempt, though there may still be other nodes available for retry. So if possible don't use stream requests if you require that all nodes are tried.


Field Summary
 
Fields inherited from class org.eclipse.smila.http.client.impl.base.RestClientBase
DEFAULT_HOSTANDPORT
 
Constructor Summary
FailoverRestClient(java.util.List<java.lang.String> hostsAndPorts)
          Talk to the given SMILA servers.
FailoverRestClient(java.util.List<java.lang.String> hostsAndPorts, ClientConnectionManager connectionManager)
          Talk to given SMILA server, using a given connection manager.
FailoverRestClient(java.util.List<java.lang.String> hostsAndPorts, int maxTotalConnections, int maxConnectionsPerHost)
          Talk to the given SMILA server, using a non-default connection configuration.
FailoverRestClient(java.lang.String... hostsAndPorts)
          Talk to the given SMILA servers.
 
Method Summary
 
Methods inherited from class org.eclipse.smila.http.client.impl.base.RestClientBase
createConnectErrorMessage, createUrl, delete, doRequest, get, getBulk, getHostAndPort, invoke, invoke, invoke, invoke, invokeAsMap, post, post, post, post, put, put, setClientParameter, setRequestExecutor, setRequestFactory, setResultHandler, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailoverRestClient

public FailoverRestClient(java.lang.String... hostsAndPorts)
Talk to the given SMILA servers.

Parameters:
hostsAndPorts - list of hosts and ports of SMILA services, in format "host:port". Don't include a trailing slash ("/").

FailoverRestClient

public FailoverRestClient(java.util.List<java.lang.String> hostsAndPorts)
Talk to the given SMILA servers.

Parameters:
hostsAndPorts - list of hosts and ports of SMILA services, in format "host:port". Don't include a trailing slash ("/").

FailoverRestClient

public FailoverRestClient(java.util.List<java.lang.String> hostsAndPorts,
                          int maxTotalConnections,
                          int maxConnectionsPerHost)
Talk to the given SMILA server, using a non-default connection configuration.

Parameters:
hostsAndPorts - list of hosts and ports of SMILA services, in format "host:port". Don't include a trailing slash ("/").
maxTotalConnections - maximum number of total HTTP connections
maxConnectionsPerHost - maximum number of connections per host

FailoverRestClient

public FailoverRestClient(java.util.List<java.lang.String> hostsAndPorts,
                          ClientConnectionManager connectionManager)
Talk to given SMILA server, using a given connection manager.

Parameters:
hostsAndPorts - list of hosts and ports of SMILA services, in format "host:port". Don't include a trailing slash ("/").
connectionManager - an initialized Apache HttpClient connection manager.

SMILA 1.0 API documentation