Top Description Inners Methods
org.eclipse.jetty.client

public Interface ConnectionPool

Known Direct Implementers
org.eclipse.jetty.client.AbstractConnectionPool
Imports
java.util.concurrent.CompletableFuture

Client-side connection pool abstraction.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ConnectionPool.Factory

Factory for ConnectionPool instances.

public static interface
ConnectionPool.MaxMultiplexable

Marks a connection as supporting multiplexed requests.

public static interface
ConnectionPool.MaxUsable

Marks a connection as being usable for a maximum number of requests.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the connection has been accepted
accept
(Connection
the connection to accept
connection
)

Accepts the given connection to be managed by this ConnectionPool.

public Connection

Returns:

an idle connection or null if no idle connections are available
acquire
(boolean
whether to schedule the opening of a connection if no idle connections are available
create
)

Returns an idle connection, if available; if an idle connection is not available, and the given create parameter is true, then schedules the opening of a new connection, if possible within the configuration of this connection pool (for example, if it does not exceed the max connection count); otherwise returns null.

public boolean

Returns:

whether the given connection is currently in use
isActive
(Connection
the connection to test
connection
)

public boolean

Returns:

whether this ConnectionPool has no open connections
isEmpty
()

public default CompletableFuture<Void>
preCreateConnections(int
the number of connections to pre-start.
connectionCount
)

Optionally pre-create up to connectionCount connections so they are immediately ready for use.

public boolean

Returns:

true if the connection has been released, false if the connection should be closed
release
(Connection
the connection to release
connection
)

Returns the given connection, previously obtained via acquire(boolean), back to this ConnectionPool.

public boolean

Returns:

true if the connection was removed from this ConnectionPool
remove
(Connection
the connection to remove
connection
)

Removes the given connection from this ConnectionPool.

Method Detail

acceptback to summary
public boolean accept(Connection connection)

Accepts the given connection to be managed by this ConnectionPool.

Parameters
connection:Connection

the connection to accept

Returns:boolean

whether the connection has been accepted

acquireback to summary
public Connection acquire(boolean create)

Returns an idle connection, if available; if an idle connection is not available, and the given create parameter is true, then schedules the opening of a new connection, if possible within the configuration of this connection pool (for example, if it does not exceed the max connection count); otherwise returns null.

Parameters
create:boolean

whether to schedule the opening of a connection if no idle connections are available

Returns:Connection

an idle connection or null if no idle connections are available

isActiveback to summary
public boolean isActive(Connection connection)
Parameters
connection:Connection

the connection to test

Returns:boolean

whether the given connection is currently in use

isEmptyback to summary
public boolean isEmpty()
Returns:boolean

whether this ConnectionPool has no open connections

preCreateConnectionsback to summary
public default CompletableFuture<Void> preCreateConnections(int connectionCount)

Optionally pre-create up to connectionCount connections so they are immediately ready for use.

Parameters
connectionCount:int

the number of connections to pre-start.

releaseback to summary
public boolean release(Connection connection)

Returns the given connection, previously obtained via acquire(boolean), back to this ConnectionPool.

Parameters
connection:Connection

the connection to release

Returns:boolean

true if the connection has been released, false if the connection should be closed

removeback to summary
public boolean remove(Connection connection)

Removes the given connection from this ConnectionPool.

Parameters
connection:Connection

the connection to remove

Returns:boolean

true if the connection was removed from this ConnectionPool

org.eclipse.jetty.client back to summary

public Interface ConnectionPool.Factory


Factory for ConnectionPool instances.

Method Summary

Modifier and TypeMethod and Description
public ConnectionPool

Returns:

the newly created ConnectionPool
newConnectionPool
(Destination
the destination to create the ConnectionPool for
destination
)

Creates a new ConnectionPool for the given destination.

Method Detail

newConnectionPoolback to summary
public ConnectionPool newConnectionPool(Destination destination)

Creates a new ConnectionPool for the given destination.

Parameters
destination:Destination

the destination to create the ConnectionPool for

Returns:ConnectionPool

the newly created ConnectionPool

org.eclipse.jetty.client back to summary

public Interface ConnectionPool.MaxMultiplexable


Marks a connection as supporting multiplexed requests.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the max number of requests multiplexable on a single connection
getMaxMultiplex
()

Method Detail

getMaxMultiplexback to summary
public int getMaxMultiplex()
Returns:int

the max number of requests multiplexable on a single connection

org.eclipse.jetty.client back to summary

public Interface ConnectionPool.MaxUsable


Marks a connection as being usable for a maximum number of requests.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the max number of requests on a single connection
getMaxUsage
()

Method Detail

getMaxUsageback to summary
public int getMaxUsage()
Returns:int

the max number of requests on a single connection