public class MultiplexConnectionPool extends AbstractConnectionPool implements ConnectionPool.Multiplexable, Sweeper.Sweepable
ConnectionPool.Factory, ConnectionPool.Multiplexable
Constructor and Description |
---|
MultiplexConnectionPool(HttpDestination destination,
int maxConnections,
Callback requester,
int maxMultiplex) |
Modifier and Type | Method and Description |
---|---|
Connection |
acquire()
Returns an idle connection, if available, or schedules the opening
of a new connection and returns
null . |
protected Connection |
activate() |
void |
close()
Closes this ConnectionPool.
|
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 |
lock() |
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.
|
protected boolean |
remove(Connection connection,
boolean force) |
void |
setMaxMultiplex(int maxMultiplex) |
boolean |
sweep() |
java.lang.String |
toString() |
protected void |
unlock() |
acquired, active, close, dump, getConnectionCount, getMaxConnectionCount, getPendingCount, idle, isClosed, isEmpty, proceed, released, removed, tryCreate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dump, dumpObject, dumpObjects, dumpSelf
public MultiplexConnectionPool(HttpDestination destination, int maxConnections, Callback requester, int maxMultiplex)
public Connection acquire()
ConnectionPool
Returns an idle connection, if available, or schedules the opening
of a new connection and returns null
.
acquire
in interface ConnectionPool
acquire
in class AbstractConnectionPool
protected void lock()
protected void unlock()
public int getMaxMultiplex()
getMaxMultiplex
in interface ConnectionPool.Multiplexable
public void setMaxMultiplex(int maxMultiplex)
setMaxMultiplex
in interface ConnectionPool.Multiplexable
maxMultiplex
- the max number of requests multiplexable on a single connectionpublic boolean isActive(Connection connection)
isActive
in interface ConnectionPool
connection
- the connection to testprotected void onCreated(Connection connection)
onCreated
in class AbstractConnectionPool
protected Connection activate()
activate
in class AbstractConnectionPool
public boolean release(Connection connection)
ConnectionPool
Returns the given connection, previously obtained via ConnectionPool.acquire()
,
back to this ConnectionPool.
release
in interface ConnectionPool
connection
- the connection to releasepublic boolean remove(Connection connection)
ConnectionPool
Removes the given connection from this ConnectionPool.
remove
in interface ConnectionPool
connection
- the connection to removeprotected boolean remove(Connection connection, boolean force)
public void close()
ConnectionPool
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface ConnectionPool
close
in class AbstractConnectionPool
ConnectionPool.isClosed()
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Dumpable
public boolean sweep()
sweep
in interface Sweeper.Sweepable
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2023 Webtide. All rights reserved.