Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.

This commit is contained in:
Simone Bordet 2020-06-01 17:24:36 +02:00
commit b8b88b238e
2 changed files with 6 additions and 3 deletions

View File

@ -53,6 +53,11 @@ public abstract class AbstractConnectionPool implements ConnectionPool, Dumpable
this.requester = requester; this.requester = requester;
} }
protected HttpDestination getHttpDestination()
{
return destination;
}
@ManagedAttribute(value = "The max number of connections", readonly = true) @ManagedAttribute(value = "The max number of connections", readonly = true)
public int getMaxConnectionCount() public int getMaxConnectionCount()
{ {

View File

@ -40,7 +40,6 @@ public class MultiplexConnectionPool extends AbstractConnectionPool implements C
{ {
private static final Logger LOG = LoggerFactory.getLogger(MultiplexConnectionPool.class); private static final Logger LOG = LoggerFactory.getLogger(MultiplexConnectionPool.class);
private final HttpDestination destination;
private final Deque<Holder> idleConnections; private final Deque<Holder> idleConnections;
private final Map<Connection, Holder> activeConnections; private final Map<Connection, Holder> activeConnections;
private int maxMultiplex; private int maxMultiplex;
@ -48,7 +47,6 @@ public class MultiplexConnectionPool extends AbstractConnectionPool implements C
public MultiplexConnectionPool(HttpDestination destination, int maxConnections, Callback requester, int maxMultiplex) public MultiplexConnectionPool(HttpDestination destination, int maxConnections, Callback requester, int maxMultiplex)
{ {
super(destination, maxConnections, requester); super(destination, maxConnections, requester);
this.destination = destination;
this.idleConnections = new ArrayDeque<>(maxConnections); this.idleConnections = new ArrayDeque<>(maxConnections);
this.activeConnections = new LinkedHashMap<>(maxConnections); this.activeConnections = new LinkedHashMap<>(maxConnections);
this.maxMultiplex = maxMultiplex; this.maxMultiplex = maxMultiplex;
@ -60,7 +58,7 @@ public class MultiplexConnectionPool extends AbstractConnectionPool implements C
Connection connection = activate(); Connection connection = activate();
if (connection == null) if (connection == null)
{ {
int queuedRequests = destination.getQueuedRequestCount(); int queuedRequests = getHttpDestination().getQueuedRequestCount();
int maxMultiplex = getMaxMultiplex(); int maxMultiplex = getMaxMultiplex();
int maxPending = ceilDiv(queuedRequests, maxMultiplex); int maxPending = ceilDiv(queuedRequests, maxMultiplex);
tryCreate(maxPending); tryCreate(maxPending);