Class LoadBalancingProxyClient
- java.lang.Object
-
- io.undertow.server.handlers.proxy.LoadBalancingProxyClient
-
- All Implemented Interfaces:
ProxyClient
public class LoadBalancingProxyClient extends java.lang.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 Modifier and Type Class Description 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 Description LoadBalancingProxyClient()
LoadBalancingProxyClient(UndertowClient client)
LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker)
LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker, LoadBalancingProxyClient.HostSelector hostSelector)
LoadBalancingProxyClient(ExclusivityChecker client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoadBalancingProxyClient
addHost(java.net.InetSocketAddress bindAddress, java.net.URI host, java.lang.String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options)
LoadBalancingProxyClient
addHost(java.net.URI host)
LoadBalancingProxyClient
addHost(java.net.URI host, java.lang.String jvmRoute)
LoadBalancingProxyClient
addHost(java.net.URI host, java.lang.String jvmRoute, org.xnio.ssl.XnioSsl ssl)
LoadBalancingProxyClient
addHost(java.net.URI host, java.lang.String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options)
LoadBalancingProxyClient
addHost(java.net.URI host, org.xnio.ssl.XnioSsl ssl)
LoadBalancingProxyClient
addSessionCookieName(java.lang.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.java.util.List<ProxyClient.ProxyTarget>
getAllTargets()
void
getConnection(ProxyClient.ProxyTarget target, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, long timeout, java.util.concurrent.TimeUnit timeUnit)
Gets a proxy connection for the given request.int
getConnectionsPerThread()
int
getMaxQueueSize()
int
getProblemServerRetry()
protected java.util.Iterator<java.lang.CharSequence>
parseRoutes(HttpServerExchange exchange)
LoadBalancingProxyClient
removeHost(java.net.URI uri)
LoadBalancingProxyClient
removeSessionCookieName(java.lang.String sessionCookieName)
protected LoadBalancingProxyClient.Host
selectHost(HttpServerExchange exchange)
LoadBalancingProxyClient
setConnectionsPerThread(int connectionsPerThread)
LoadBalancingProxyClient
setMaxQueueSize(int maxQueueSize)
LoadBalancingProxyClient
setProblemServerRetry(int problemServerRetry)
LoadBalancingProxyClient
setRankedRoutingDelimiter(java.lang.String rankedRoutingDelimiter)
Configures ranked route delimiter, enabling ranked routing parsing strategy.LoadBalancingProxyClient
setRouteParsingStrategy(RouteParsingStrategy routeParsingStrategy)
LoadBalancingProxyClient
setSoftMaxConnectionsPerThread(int softMaxConnectionsPerThread)
LoadBalancingProxyClient
setTtl(int ttl)
-
-
-
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 java.util.List<ProxyClient.ProxyTarget> getAllTargets()
- Specified by:
getAllTargets
in interfaceProxyClient
-
addSessionCookieName
public LoadBalancingProxyClient addSessionCookieName(java.lang.String sessionCookieName)
-
removeSessionCookieName
public LoadBalancingProxyClient removeSessionCookieName(java.lang.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(java.lang.String rankedRoutingDelimiter)
Configures ranked route delimiter, enabling ranked routing parsing strategy.
-
addHost
public LoadBalancingProxyClient addHost(java.net.URI host)
-
addHost
public LoadBalancingProxyClient addHost(java.net.URI host, org.xnio.ssl.XnioSsl ssl)
-
addHost
public LoadBalancingProxyClient addHost(java.net.URI host, java.lang.String jvmRoute)
-
addHost
public LoadBalancingProxyClient addHost(java.net.URI host, java.lang.String jvmRoute, org.xnio.ssl.XnioSsl ssl)
-
addHost
public LoadBalancingProxyClient addHost(java.net.URI host, java.lang.String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options)
-
addHost
public LoadBalancingProxyClient addHost(java.net.InetSocketAddress bindAddress, java.net.URI host, java.lang.String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options)
-
removeHost
public LoadBalancingProxyClient removeHost(java.net.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 interfaceProxyClient
- Parameters:
exchange
- The exchange- Returns:
- The proxy target
-
getConnection
public void getConnection(ProxyClient.ProxyTarget target, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, long timeout, java.util.concurrent.TimeUnit timeUnit)
Description copied from interface:ProxyClient
Gets a proxy connection for the given request.- Specified by:
getConnection
in interfaceProxyClient
exchange
- The exchangecallback
- The callbacktimeout
- The timeouttimeUnit
- Time unit for the timeout
-
selectHost
protected LoadBalancingProxyClient.Host selectHost(HttpServerExchange exchange)
-
parseRoutes
protected java.util.Iterator<java.lang.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.
-
-