io.undertow.server.handlers.proxy

## Class LoadBalancingProxyClient

- java.lang.Object
- - io.undertow.server.handlers.proxy.LoadBalancingProxyClient

All Implemented Interfaces:
  ProxyClient

    public class LoadBalancingProxyClient
    extends Object
    implements ProxyClient

Initial implementation of a load balancing proxy client. This initial implementation is rather simplistic, and will likely change.

Author:
  Stuart Douglas, Richard Opalka

### Nested Class Summary

Nested Classes
`class` `LoadBalancingProxyClient.Host`
`static interface` `LoadBalancingProxyClient.HostSelector`

### Nested classes/interfaces inherited from interface io.undertow.server.handlers.proxy.ProxyClient

`ProxyClient.HostProxyTarget, ProxyClient.MaxRetriesProxyTarget, ProxyClient.ProxyTarget`

### Constructor Summary

Constructors
Constructor and Description
`LoadBalancingProxyClient()`
`LoadBalancingProxyClient(ExclusivityChecker client)`
`LoadBalancingProxyClient(UndertowClient client)`
`LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker)`
`LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker, LoadBalancingProxyClient.HostSelector hostSelector)`

### Method Summary

All Methods Instance Methods Concrete Methods
`LoadBalancingProxyClient` `addHost(InetSocketAddress bindAddress, URI host, String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options)`
`LoadBalancingProxyClient` `addHost(URI host)`
`LoadBalancingProxyClient` `addHost(URI host, String jvmRoute)`
`LoadBalancingProxyClient` `addHost(URI host, String jvmRoute, org.xnio.ssl.XnioSsl ssl)`
`LoadBalancingProxyClient` `addHost(URI host, String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options)`
`LoadBalancingProxyClient` `addHost(URI host, org.xnio.ssl.XnioSsl ssl)`
`LoadBalancingProxyClient` `addSessionCookieName(String sessionCookieName)`
`void` `closeCurrentConnections()` Should only be used for tests DO NOT CALL THIS METHOD WHEN REQUESTS ARE IN PROGRESS It is not thread safe so internal state can get messed up.
`ProxyClient.ProxyTarget` `findTarget(HttpServerExchange exchange)` Finds a proxy target for this request, returning null if none can be found.
`List<ProxyClient.ProxyTarget>` `getAllTargets()`
`void` `getConnection(ProxyClient.ProxyTarget target, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit)` Gets a proxy connection for the given request.
`int` `getConnectionsPerThread()`
`int` `getMaxQueueSize()`
`int` `getProblemServerRetry()`
`protected Iterator<CharSequence>` `parseRoutes(HttpServerExchange exchange)`
`LoadBalancingProxyClient` `removeHost(URI uri)`
`LoadBalancingProxyClient` `removeSessionCookieName(String sessionCookieName)`
`protected LoadBalancingProxyClient.Host` `selectHost(HttpServerExchange exchange)`
`LoadBalancingProxyClient` `setConnectionsPerThread(int connectionsPerThread)`
`LoadBalancingProxyClient` `setMaxQueueSize(int maxQueueSize)`
`LoadBalancingProxyClient` `setProblemServerRetry(int problemServerRetry)`
`LoadBalancingProxyClient` `setRankedRoutingDelimiter(String rankedRoutingDelimiter)` Configures ranked route delimiter, enabling ranked routing parsing strategy.
`LoadBalancingProxyClient` `setRouteParsingStrategy(RouteParsingStrategy routeParsingStrategy)`
`LoadBalancingProxyClient` `setSoftMaxConnectionsPerThread(int softMaxConnectionsPerThread)`
`LoadBalancingProxyClient` `setTtl(int ttl)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### LoadBalancingProxyClient

    public LoadBalancingProxyClient()

#### LoadBalancingProxyClient

    public LoadBalancingProxyClient(UndertowClient client)

#### LoadBalancingProxyClient

    public LoadBalancingProxyClient(ExclusivityChecker client)

#### LoadBalancingProxyClient

    public LoadBalancingProxyClient(UndertowClient client,
                                    ExclusivityChecker exclusivityChecker)

#### LoadBalancingProxyClient

    public LoadBalancingProxyClient(UndertowClient client,
                                    ExclusivityChecker exclusivityChecker,
                                    LoadBalancingProxyClient.HostSelector hostSelector)

### Method Detail

#### getAllTargets

    public List<ProxyClient.ProxyTarget> getAllTargets()

Specified by:
  `getAllTargets` in interface `ProxyClient`

#### addSessionCookieName

    public LoadBalancingProxyClient addSessionCookieName(String sessionCookieName)

#### removeSessionCookieName

    public LoadBalancingProxyClient removeSessionCookieName(String sessionCookieName)

#### setProblemServerRetry

    public LoadBalancingProxyClient setProblemServerRetry(int problemServerRetry)

#### getProblemServerRetry

    public int getProblemServerRetry()

#### getConnectionsPerThread

    public int getConnectionsPerThread()

#### setConnectionsPerThread

    public LoadBalancingProxyClient setConnectionsPerThread(int connectionsPerThread)

#### getMaxQueueSize

    public int getMaxQueueSize()

#### setMaxQueueSize

    public LoadBalancingProxyClient setMaxQueueSize(int maxQueueSize)

#### setTtl

    public LoadBalancingProxyClient setTtl(int ttl)

#### setSoftMaxConnectionsPerThread

    public LoadBalancingProxyClient setSoftMaxConnectionsPerThread(int softMaxConnectionsPerThread)

#### setRouteParsingStrategy

    public LoadBalancingProxyClient setRouteParsingStrategy(RouteParsingStrategy routeParsingStrategy)

#### setRankedRoutingDelimiter

    public LoadBalancingProxyClient setRankedRoutingDelimiter(String rankedRoutingDelimiter)

Configures ranked route delimiter, enabling ranked routing parsing strategy.

#### addHost

    public LoadBalancingProxyClient addHost(URI host)

#### addHost

    public LoadBalancingProxyClient addHost(URI host,
                                            org.xnio.ssl.XnioSsl ssl)

#### addHost

    public LoadBalancingProxyClient addHost(URI host,
                                            String jvmRoute)

#### addHost

    public LoadBalancingProxyClient addHost(URI host,
                                            String jvmRoute,
                                            org.xnio.ssl.XnioSsl ssl)

#### addHost

    public LoadBalancingProxyClient addHost(URI host,
                                            String jvmRoute,
                                            org.xnio.ssl.XnioSsl ssl,
                                            org.xnio.OptionMap options)

#### addHost

    public LoadBalancingProxyClient addHost(InetSocketAddress bindAddress,
                                            URI host,
                                            String jvmRoute,
                                            org.xnio.ssl.XnioSsl ssl,
                                            org.xnio.OptionMap options)

#### removeHost

    public LoadBalancingProxyClient removeHost(URI uri)

#### findTarget

    public ProxyClient.ProxyTarget findTarget(HttpServerExchange exchange)

Description copied from interface: `ProxyClient`
Finds a proxy target for this request, returning null if none can be found. If this method returns null it means that there is no backend available to handle this request, and it should proceed as normal.

Specified by:
  `findTarget` in interface `ProxyClient`
Parameters:
  `exchange` - The exchange
Returns:
  The proxy target

#### getConnection

    public void getConnection(ProxyClient.ProxyTarget target,
                              HttpServerExchange exchange,
                              ProxyCallback<ProxyConnection> callback,
                              long timeout,
                              TimeUnit timeUnit)

Description copied from interface: `ProxyClient`
Gets a proxy connection for the given request.

Specified by:
  `getConnection` in interface `ProxyClient`
  `exchange` - The exchange
  `callback` - The callback
  `timeout` - The timeout
  `timeUnit` - Time unit for the timeout

#### selectHost

    protected LoadBalancingProxyClient.Host selectHost(HttpServerExchange exchange)

#### parseRoutes

    protected Iterator<CharSequence> parseRoutes(HttpServerExchange exchange)

#### closeCurrentConnections

    public void closeCurrentConnections()

Should only be used for tests DO NOT CALL THIS METHOD WHEN REQUESTS ARE IN PROGRESS It is not thread safe so internal state can get messed up.