public synchronized LoadBalancingProxyClient addHost(final URI host) { return addHost(host, null, null); }
final LoadBalancingProxyClient lb = new LoadBalancingProxyClient(exchange -> { .setConnectionsPerThread(connectionsPerThread) .setMaxQueueSize(requestQueueSize) .setSoftMaxConnectionsPerThread(cachedConnectionsPerThread) .setTtl(connectionIdleTimeout) .setProblemServerRetry(problemServerRetry); String[] sessionIds = sessionCookieNames.split(","); for (String id : sessionIds) { lb.addSessionCookieName(id);
@Override public void stop(StopContext stopContext) { ProxyHandler proxyHandler = (ProxyHandler) (this.proxyHandler.getValue() instanceof GlobalRequestControllerHandler ? ((GlobalRequestControllerHandler)this.proxyHandler.getValue()).getNext() : this.proxyHandler.getValue()); final LoadBalancingProxyClient client = (LoadBalancingProxyClient) proxyHandler.getProxyClient(); try { client.removeHost(getUri()); } catch (URISyntaxException e) { throw new RuntimeException(e); //impossible } }
@Override public HttpHandler wrap(HttpHandler handler) { final LoadBalancingProxyClient loadBalancingProxyClient = new LoadBalancingProxyClient(); for (URI url : uris) { loadBalancingProxyClient.addHost(url); } return new ProxyHandler(loadBalancingProxyClient, -1, handler, rewriteHostHeader, false); } }
LoadBalancingProxyClient proxy = new LoadBalancingProxyClient() .addHost(new URI("https://localhost:8443"), null, new UndertowXnioSsl(Xnio.getInstance(), OptionMap.EMPTY, clientSslContext), OptionMap.create(UndertowOptions.ENABLE_HTTP2, true)) .setConnectionsPerThread(20);
proxyClient.removeHost(entryToURI(entry)); } catch (URISyntaxException ex) { log.log(Level.WARNING, "Error converting topology entry to URI", ex); proxyClient.addHost(entryToURI(entry)); } catch (URISyntaxException ex) { log.log(Level.WARNING, "Error converting topology entry to URI", ex);
final Host host = selectHost(exchange); if (host == null) { callback.couldNotResolveBackend(exchange);
return null; Host sticky = findStickyHost(exchange); if (sticky != null) { if(attempted == null || !attempted.contains(sticky)) {
@Override public HttpHandler wrap(HttpHandler handler) { final LoadBalancingProxyClient loadBalancingProxyClient = new LoadBalancingProxyClient(); for (URI url : uris) { loadBalancingProxyClient.addHost(url); } return new ProxyHandler(loadBalancingProxyClient, -1, handler, rewriteHostHeader, false); } }
@Override protected Host selectHost(HttpServerExchange exchange) { Host host = super.selectHost(exchange); if (host != null) { uri = host.getUri().toString(); } return host; }
return null; Host sticky = findStickyHost(exchange); if (sticky != null) { if(attempted == null || !attempted.contains(sticky)) {
final LoadBalancingProxyClient lb = new LoadBalancingProxyClient(exchange -> { .setConnectionsPerThread(connectionsPerThread) .setMaxQueueSize(requestQueueSize) .setSoftMaxConnectionsPerThread(cachedConnectionsPerThread) .setTtl(connectionIdleTimeout) .setProblemServerRetry(problemServerRetry); String[] sessionIds = sessionCookieNames.split(","); for (String id : sessionIds) { lb.addSessionCookieName(id);
public synchronized LoadBalancingProxyClient addHost(final URI host, XnioSsl ssl) { return addHost(host, null, ssl); }
@Override public HttpHandler wrap(HttpHandler handler) { final LoadBalancingProxyClient loadBalancingProxyClient = new LoadBalancingProxyClient(); for (URI url : uris) { loadBalancingProxyClient.addHost(url); } return new ProxyHandler(loadBalancingProxyClient, -1, handler, rewriteHostHeader, false); } }
public synchronized void removeContainer(String containerId, URI serverURI) { LoadBalancingProxyClient client = containerClients.get(containerId); if (client == null) { log.debugf("No backend server found for %s and server URI %s", containerId, serverURI); return; } client.removeHost(serverURI); }
@Override protected Host selectHost(HttpServerExchange exchange) { Host host = super.selectHost(exchange); if (host != null) { uri = host.getUri().toString(); } return host; }
return null; Host sticky = findStickyHost(exchange); if (sticky != null) { if(attempted == null || !attempted.contains(sticky)) {
final LoadBalancingProxyClient lb = new LoadBalancingProxyClient(exchange -> { .setConnectionsPerThread(connectionsPerThread) .setMaxQueueSize(requestQueueSize) .setSoftMaxConnectionsPerThread(cachedConnectionsPerThread) .setTtl(connectionIdleTimeout) .setProblemServerRetry(problemServerRetry); String[] sessionIds = sessionCookieNames.split(","); for (String id : sessionIds) { lb.addSessionCookieName(id);
public synchronized LoadBalancingProxyClient addHost(final URI host, String jvmRoute) { return addHost(host, jvmRoute, null); }
@Override public HttpHandler wrap(HttpHandler handler) { LoadBalancingProxyClient loadBalancingProxyClient = new LoadBalancingProxyClient(); for(URI url : uris) { loadBalancingProxyClient.addHost(url); } return new ProxyHandler(loadBalancingProxyClient, handler); } }