Package org.eclipse.jetty.client
Class AbstractConnectionPool
- java.lang.Object
-
- org.eclipse.jetty.client.AbstractConnectionPool
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ConnectionPool
,Dumpable
- Direct Known Subclasses:
DuplexConnectionPool
,MultiplexConnectionPool
,RoundRobinConnectionPool
@ManagedObject public abstract class AbstractConnectionPool extends java.lang.Object implements ConnectionPool, Dumpable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.ConnectionPool
ConnectionPool.Factory, ConnectionPool.Multiplexable
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractConnectionPool(Destination destination, int maxConnections, Callback requester)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Connection
acquire()
Returns an idle connection, if available, or schedules the opening of a new connection and returnsnull
.protected void
acquired(Connection connection)
protected abstract Connection
activate()
protected Connection
active(Connection connection)
void
close()
Closes this ConnectionPool.protected void
close(java.util.Collection<Connection> connections)
java.lang.String
dump()
int
getConnectionCount()
int
getMaxConnectionCount()
int
getPendingCount()
protected boolean
idle(Connection connection, boolean close)
boolean
isClosed()
boolean
isEmpty()
protected abstract void
onCreated(Connection connection)
protected void
proceed()
protected void
released(Connection connection)
protected void
removed(Connection connection)
protected void
tryCreate(int maxPending)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.client.ConnectionPool
isActive, release, remove
-
-
-
-
Constructor Detail
-
AbstractConnectionPool
protected AbstractConnectionPool(Destination destination, int maxConnections, Callback requester)
-
-
Method Detail
-
getMaxConnectionCount
@ManagedAttribute(value="The max number of connections", readonly=true) public int getMaxConnectionCount()
-
getConnectionCount
@ManagedAttribute(value="The number of connections", readonly=true) public int getConnectionCount()
-
getPendingCount
@ManagedAttribute(value="The number of pending connections", readonly=true) public int getPendingCount()
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceConnectionPool
- Returns:
- whether this ConnectionPool has no open connections
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceConnectionPool
- Returns:
- whether this ConnectionPool has been closed
- See Also:
ConnectionPool.close()
-
acquire
public Connection acquire()
Description copied from interface:ConnectionPool
Returns an idle connection, if available, or schedules the opening of a new connection and returns
null
.- Specified by:
acquire
in interfaceConnectionPool
- Returns:
- an available connection, or null
-
tryCreate
protected void tryCreate(int maxPending)
-
onCreated
protected abstract void onCreated(Connection connection)
-
proceed
protected void proceed()
-
activate
protected abstract Connection activate()
-
active
protected Connection active(Connection connection)
-
acquired
protected void acquired(Connection connection)
-
idle
protected boolean idle(Connection connection, boolean close)
-
released
protected void released(Connection connection)
-
removed
protected void removed(Connection connection)
-
close
public void close()
Description copied from interface:ConnectionPool
Closes this ConnectionPool.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceConnectionPool
- See Also:
ConnectionPool.isClosed()
-
close
protected void close(java.util.Collection<Connection> connections)
-
-