Class AbstractConnectionPool
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.client.AbstractConnectionPool
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ConnectionPool
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,Sweeper.Sweepable
- Direct Known Subclasses:
DuplexConnectionPool
,MultiplexConnectionPool
@ManagedObject @Deprecated(since="2021-05-27") public abstract class AbstractConnectionPool extends ContainerLifeCycle implements ConnectionPool, Dumpable, Sweeper.Sweepable
Deprecated.
-
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Connection
acquire()
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(java.lang.Appendable out, java.lang.String indent)
Deprecated.Dump this object (and children) into an Appendable using the provided indent after any new lines.int
getActiveConnectionCount()
Deprecated.java.util.Collection<Connection>
getActiveConnections()
Deprecated.Relying on this method indicates a reliance on the implementation details.int
getConnectionCount()
Deprecated.int
getIdleConnectionCount()
Deprecated.java.util.Queue<Connection>
getIdleConnections()
Deprecated.Relying on this method indicates a reliance on the implementation details.int
getMaxConnectionCount()
Deprecated.long
getMaxDuration()
Deprecated.Get the max usage duration in milliseconds of the pool's connections.int
getPendingConnectionCount()
Deprecated.int
getPendingCount()
Deprecated.usegetPendingConnectionCount()
insteadboolean
isActive(Connection connection)
Deprecated.boolean
isClosed()
Deprecated.boolean
isEmpty()
Deprecated.boolean
isMaximizeConnections()
Deprecated.java.util.concurrent.CompletableFuture<java.lang.Void>
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.java.lang.String
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 Detail
-
preCreateConnections
public java.util.concurrent.CompletableFuture<java.lang.Void> preCreateConnections(int connectionCount)
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
@ManagedAttribute(value="The number of connections", readonly=true) public int 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
@ManagedAttribute("Whether this pool is closed") public boolean isClosed()
Deprecated.- Specified by:
isClosed
in interfaceConnectionPool
- Returns:
- whether this ConnectionPool has been closed
- See Also:
ConnectionPool.close()
-
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
public Connection 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
public boolean isActive(Connection connection)
Deprecated.- Specified by:
isActive
in interfaceConnectionPool
- Parameters:
connection
- the connection to test- Returns:
- whether the given connection is currently in use
-
release
public boolean release(Connection connection)
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
public boolean remove(Connection connection)
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 public java.util.Queue<Connection> 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 public java.util.Collection<Connection> 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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceConnectionPool
- See Also:
ConnectionPool.isClosed()
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
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:
java.io.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
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classAbstractLifeCycle
-
-