Class AbstractConnectionPool
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConnectionPool
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,Sweeper.Sweepable
- Direct Known Subclasses:
DuplexConnectionPool
,MultiplexConnectionPool
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.ConnectionPool
ConnectionPool.Factory, ConnectionPool.Multiplexable
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionacquire()
Deprecated.Returns an idle connection, if available, or schedules the opening of a new connection and returnsnull
.void
close()
Deprecated.Closes this ConnectionPool.void
dump
(Appendable out, String indent) Deprecated.Dump this object (and children) into an Appendable using the provided indent after any new lines.int
Deprecated.Deprecated.Relying on this method indicates a reliance on the implementation details.int
Deprecated.int
Deprecated.Deprecated.Relying on this method indicates a reliance on the implementation details.int
Deprecated.long
Deprecated.Get the max usage duration in milliseconds of the pool's connections.int
Deprecated.int
Deprecated.usegetPendingConnectionCount()
insteadboolean
isActive
(Connection connection) Deprecated.boolean
isClosed()
Deprecated.boolean
isEmpty()
Deprecated.boolean
Deprecated.preCreateConnections
(int connectionCount) Deprecated.Optionally pre-create up toconnectionCount
connections so they are immediately ready for use.boolean
release
(Connection connection) Deprecated.Returns the given connection, previously obtained viaConnectionPool.acquire()
, back to this ConnectionPool.boolean
remove
(Connection connection) Deprecated.Removes the given connection from this ConnectionPool.void
setMaxDuration
(long maxDurationInMs) Deprecated.void
setMaximizeConnections
(boolean maximizeConnections) Deprecated.Sets whether the number of connections should be maximized.boolean
sweep()
Deprecated.toString()
Deprecated.Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Method Details
-
preCreateConnections
Deprecated.Description copied from interface:ConnectionPool
Optionally pre-create up toconnectionCount
connections so they are immediately ready for use.- Specified by:
preCreateConnections
in interfaceConnectionPool
- Parameters:
connectionCount
- the number of connections to pre-start.
-
getMaxDuration
@ManagedAttribute("The maximum duration in milliseconds a connection can be used for before it gets closed") public long getMaxDuration()Deprecated.Get the max usage duration in milliseconds of the pool's connections. Values
0
and negative mean that there is no limit.This only guarantees that a connection cannot be acquired after the configured duration elapses, so that is only enforced when
acquire()
is called. If a pool stays completely idle for a duration longer than the value returned by this method, the max duration will not be enforced. It's up to the idle timeout mechanism (seeHttpClient.getIdleTimeout()
) to handle closing idle connections. -
setMaxDuration
public void setMaxDuration(long maxDurationInMs) Deprecated. -
getActiveConnectionCount
@ManagedAttribute(value="The number of active connections", readonly=true) public int getActiveConnectionCount()Deprecated. -
getIdleConnectionCount
@ManagedAttribute(value="The number of idle connections", readonly=true) public int getIdleConnectionCount()Deprecated. -
getMaxConnectionCount
@ManagedAttribute(value="The max number of connections", readonly=true) public int getMaxConnectionCount()Deprecated. -
getConnectionCount
Deprecated. -
getPendingCount
@ManagedAttribute(value="The number of pending connections", readonly=true) @Deprecated public int getPendingCount()Deprecated.usegetPendingConnectionCount()
instead- Returns:
- the number of pending connections
-
getPendingConnectionCount
@ManagedAttribute(value="The number of pending connections", readonly=true) public int getPendingConnectionCount()Deprecated. -
isEmpty
public boolean isEmpty()Deprecated.- Specified by:
isEmpty
in interfaceConnectionPool
- Returns:
- whether this ConnectionPool has no open connections
-
isClosed
Deprecated.- Specified by:
isClosed
in interfaceConnectionPool
- Returns:
- whether this ConnectionPool has been closed
- See Also:
-
isMaximizeConnections
@ManagedAttribute("Whether the pool tries to maximize the number of connections used") public boolean isMaximizeConnections()Deprecated. -
setMaximizeConnections
public void setMaximizeConnections(boolean maximizeConnections) Deprecated.Sets whether the number of connections should be maximized.
- Parameters:
maximizeConnections
- whether the number of connections should be maximized
-
acquire
Deprecated.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
-
isActive
Deprecated.- Specified by:
isActive
in interfaceConnectionPool
- Parameters:
connection
- the connection to test- Returns:
- whether the given connection is currently in use
-
release
Deprecated.Description copied from interface:ConnectionPool
Returns the given connection, previously obtained via
ConnectionPool.acquire()
, back to this ConnectionPool.- Specified by:
release
in interfaceConnectionPool
- Parameters:
connection
- the connection to release- Returns:
- true if the connection has been released, false if the connection should be closed
-
remove
Deprecated.Description copied from interface:ConnectionPool
Removes the given connection from this ConnectionPool.
- Specified by:
remove
in interfaceConnectionPool
- Parameters:
connection
- the connection to remove- Returns:
- true if the connection was removed from this ConnectionPool
-
getIdleConnections
Deprecated.Relying on this method indicates a reliance on the implementation details.- Returns:
- an unmodifiable queue working as a view of the idle connections.
-
getActiveConnections
Deprecated.Relying on this method indicates a reliance on the implementation details.- Returns:
- an unmodifiable collection working as a view of the active connections.
-
close
public void close()Deprecated.Description copied from interface:ConnectionPool
Closes this ConnectionPool.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnectionPool
- See Also:
-
dump
Deprecated.Description copied from interface:Dumpable
Dump 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.- Specified by:
dump
in interfaceDumpable
- Overrides:
dump
in classContainerLifeCycle
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
sweep
public boolean sweep()Deprecated.- Specified by:
sweep
in interfaceSweeper.Sweepable
- Returns:
- whether this resource should be swept
-
toString
Deprecated.- Overrides:
toString
in classAbstractLifeCycle
-