@ManagedObject public class RoundRobinConnectionPool extends AbstractConnectionPool implements ConnectionPool.Multiplexable
| Modifier and Type | Class and Description |
|---|---|
private static class |
RoundRobinConnectionPool.Entry |
ConnectionPool.Factory, ConnectionPool.Multiplexable| Modifier and Type | Field and Description |
|---|---|
private java.util.List<RoundRobinConnectionPool.Entry> |
entries |
private int |
index |
private int |
maxMultiplex |
| Constructor and Description |
|---|
RoundRobinConnectionPool(Destination destination,
int maxConnections,
Callback requester) |
RoundRobinConnectionPool(Destination destination,
int maxConnections,
Callback requester,
int maxMultiplex) |
| Modifier and Type | Method and Description |
|---|---|
protected Connection |
acquire(boolean create)
Returns an idle connection, if available, following a round robin algorithm;
otherwise it always tries to create a new connection, up until the max connection count.
|
protected Connection |
activate() |
void |
dump(java.lang.Appendable out,
java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
int |
getMaxMultiplex() |
boolean |
isActive(Connection connection) |
protected void |
onCreated(Connection connection) |
boolean |
release(Connection connection)
Returns the given connection, previously obtained via
ConnectionPool.acquire(),
back to this ConnectionPool. |
boolean |
remove(Connection connection)
Removes the given connection from this ConnectionPool.
|
void |
setMaxMultiplex(int maxMultiplex) |
java.lang.String |
toString() |
acquire, acquired, active, close, close, dump, getConnectionCount, getHttpDestination, getMaxConnectionCount, getPendingConnectionCount, getPendingCount, idle, isClosed, isEmpty, proceed, released, removed, tryCreateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdump, dumpContainer, dumpIterable, dumpMapEntries, dumpObject, dumpObjects, dumpSelf, namedprivate final java.util.List<RoundRobinConnectionPool.Entry> entries
private int maxMultiplex
private int index
public RoundRobinConnectionPool(Destination destination, int maxConnections, Callback requester)
public RoundRobinConnectionPool(Destination destination, int maxConnections, Callback requester, int maxMultiplex)
public int getMaxMultiplex()
getMaxMultiplex in interface ConnectionPool.Multiplexablepublic void setMaxMultiplex(int maxMultiplex)
setMaxMultiplex in interface ConnectionPool.MultiplexablemaxMultiplex - the max number of requests multiplexable on a single connectionprotected Connection acquire(boolean create)
Returns an idle connection, if available, following a round robin algorithm; otherwise it always tries to create a new connection, up until the max connection count.
acquire in class AbstractConnectionPoolcreate - this parameter is ignored and assumed to be always truenull if no idle connections are availableAbstractConnectionPool.tryCreate(int)protected void onCreated(Connection connection)
onCreated in class AbstractConnectionPoolprotected Connection activate()
activate in class AbstractConnectionPoolpublic boolean isActive(Connection connection)
isActive in interface ConnectionPoolconnection - the connection to testpublic boolean release(Connection connection)
ConnectionPoolReturns the given connection, previously obtained via ConnectionPool.acquire(),
back to this ConnectionPool.
release in interface ConnectionPoolconnection - the connection to releasepublic boolean remove(Connection connection)
ConnectionPoolRemoves the given connection from this ConnectionPool.
remove in interface ConnectionPoolconnection - the connection to removepublic void dump(java.lang.Appendable out,
java.lang.String indent)
throws java.io.IOException
Dumpablepublic java.lang.String toString()
toString in class java.lang.Object