Package org.eclipse.jetty.client
Class DuplexConnectionPool
- java.lang.Object
-
- org.eclipse.jetty.client.AbstractConnectionPool
-
- org.eclipse.jetty.client.DuplexConnectionPool
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ConnectionPool,Dumpable,Sweeper.Sweepable
- Direct Known Subclasses:
LeakTrackingConnectionPool,ValidatingConnectionPool
@ManagedObject public class DuplexConnectionPool extends AbstractConnectionPool implements Sweeper.Sweepable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.ConnectionPool
ConnectionPool.Factory, ConnectionPool.Multiplexable
-
-
Constructor Summary
Constructors Constructor Description DuplexConnectionPool(Destination destination, int maxConnections, Callback requester)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Connectionactivate()voidclose()Closes this ConnectionPool.protected booleandeactivate(Connection connection)voiddump(java.lang.Appendable out, java.lang.String indent)Dump this object (and children) into an Appendable using the provided indent after any new lines.protected voiddump(java.lang.Appendable out, java.lang.String indent, java.lang.Object... items)intgetActiveConnectionCount()java.util.Collection<Connection>getActiveConnections()intgetIdleConnectionCount()java.util.Queue<Connection>getIdleConnections()booleanisActive(Connection connection)protected voidlock()protected voidonCreated(Connection connection)booleanrelease(Connection connection)Returns the given connection, previously obtained viaConnectionPool.acquire(), back to this ConnectionPool.booleanremove(Connection connection)Removes the given connection from this ConnectionPool.protected booleanremove(Connection connection, boolean force)booleansweep()java.lang.StringtoString()protected voidunlock()-
Methods inherited from class org.eclipse.jetty.client.AbstractConnectionPool
acquire, acquired, active, close, dump, getConnectionCount, getMaxConnectionCount, getPendingConnectionCount, getPendingCount, idle, isClosed, isEmpty, proceed, released, removed, tryCreate
-
-
-
-
Constructor Detail
-
DuplexConnectionPool
public DuplexConnectionPool(Destination destination, int maxConnections, Callback requester)
-
-
Method Detail
-
lock
protected void lock()
-
unlock
protected void unlock()
-
getIdleConnectionCount
@ManagedAttribute(value="The number of idle connections", readonly=true) public int getIdleConnectionCount()
-
getActiveConnectionCount
@ManagedAttribute(value="The number of active connections", readonly=true) public int getActiveConnectionCount()
-
getIdleConnections
public java.util.Queue<Connection> getIdleConnections()
-
getActiveConnections
public java.util.Collection<Connection> getActiveConnections()
-
isActive
public boolean isActive(Connection connection)
- Specified by:
isActivein interfaceConnectionPool- Parameters:
connection- the connection to test- Returns:
- whether the given connection is currently in use
-
onCreated
protected void onCreated(Connection connection)
- Specified by:
onCreatedin classAbstractConnectionPool
-
activate
protected Connection activate()
- Specified by:
activatein classAbstractConnectionPool
-
release
public boolean release(Connection connection)
Description copied from interface:ConnectionPoolReturns the given connection, previously obtained via
ConnectionPool.acquire(), back to this ConnectionPool.- Specified by:
releasein interfaceConnectionPool- Parameters:
connection- the connection to release- Returns:
- true if the connection has been released, false if the connection should be closed
-
deactivate
protected boolean deactivate(Connection connection)
-
remove
public boolean remove(Connection connection)
Description copied from interface:ConnectionPoolRemoves the given connection from this ConnectionPool.
- Specified by:
removein interfaceConnectionPool- Parameters:
connection- the connection to remove- Returns:
- true if the connection was removed from this ConnectionPool
-
remove
protected boolean remove(Connection connection, boolean force)
-
close
public void close()
Description copied from interface:ConnectionPoolCloses this ConnectionPool.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceConnectionPool- Overrides:
closein classAbstractConnectionPool- See Also:
ConnectionPool.isClosed()
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOExceptionDescription copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
-
dump
protected void dump(java.lang.Appendable out, java.lang.String indent, java.lang.Object... items) throws java.io.IOException- Throws:
java.io.IOException
-
sweep
public boolean sweep()
- Specified by:
sweepin interfaceSweeper.Sweepable- Returns:
- whether this resource should be swept
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-