Class LoadBalancingProxyClient
java.lang.Object
io.undertow.server.handlers.proxy.LoadBalancingProxyClient
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionfinal classstatic interfaceNested classes/interfaces inherited from interface io.undertow.server.handlers.proxy.ProxyClient
ProxyClient.HostProxyTarget, ProxyClient.MaxRetriesProxyTarget, ProxyClient.ProxyTarget -
Constructor Summary
ConstructorsConstructorDescriptionLoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker) LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker, LoadBalancingProxyClient.HostSelector hostSelector) -
Method Summary
Modifier and TypeMethodDescriptionaddHost(InetSocketAddress bindAddress, URI host, String jvmRoute, org.xnio.ssl.XnioSsl ssl, org.xnio.OptionMap options) addSessionCookieName(String sessionCookieName) voidShould 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.findTarget(HttpServerExchange exchange) Finds a proxy target for this request, returning null if none can be found.voidgetConnection(ProxyClient.ProxyTarget target, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit) Gets a proxy connection for the given request.intintintprotected Iterator<CharSequence>parseRoutes(HttpServerExchange exchange) removeHost(URI uri) removeSessionCookieName(String sessionCookieName) protected LoadBalancingProxyClient.HostselectHost(HttpServerExchange exchange) setConnectionsPerThread(int connectionsPerThread) setMaxQueueSize(int maxQueueSize) setProblemServerRetry(int problemServerRetry) setRankedRoutingDelimiter(String rankedRoutingDelimiter) Configures ranked route delimiter, enabling ranked routing parsing strategy.setRouteParsingStrategy(RouteParsingStrategy routeParsingStrategy) setSoftMaxConnectionsPerThread(int softMaxConnectionsPerThread) setTtl(int ttl)
-
Constructor Details
-
LoadBalancingProxyClient
public LoadBalancingProxyClient() -
LoadBalancingProxyClient
-
LoadBalancingProxyClient
-
LoadBalancingProxyClient
-
LoadBalancingProxyClient
public LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker, LoadBalancingProxyClient.HostSelector hostSelector)
-
-
Method Details
-
getAllTargets
- Specified by:
getAllTargetsin interfaceProxyClient
-
addSessionCookieName
-
removeSessionCookieName
-
setProblemServerRetry
-
getProblemServerRetry
public int getProblemServerRetry() -
getConnectionsPerThread
public int getConnectionsPerThread() -
setConnectionsPerThread
-
getMaxQueueSize
public int getMaxQueueSize() -
setMaxQueueSize
-
setTtl
-
setSoftMaxConnectionsPerThread
-
setRouteParsingStrategy
-
setRankedRoutingDelimiter
Configures ranked route delimiter, enabling ranked routing parsing strategy. -
addHost
-
addHost
-
addHost
-
addHost
-
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
-
findTarget
Description copied from interface:ProxyClientFinds 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:
findTargetin interfaceProxyClient- 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:ProxyClientGets a proxy connection for the given request.- Specified by:
getConnectionin interfaceProxyClientexchange- The exchangecallback- The callbacktimeout- The timeouttimeUnit- Time unit for the timeout
-
selectHost
-
parseRoutes
-
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.
-