public interface OutboundConnectionCache<C extends Connection> extends ConnectionCache<C>
This cache places minimal requirements on the Connections that it contains:
Some simple methods are provided for monitoring the state of the cache: numbers of busy and idle connections, and the total number of connections in the cache.
| Modifier and Type | Method and Description |
|---|---|
boolean |
canCreateNewConnection(ContactInfo<C> cinfo)
Determine whether a new connection could be created by the
ConnectionCache or not.
|
C |
get(ContactInfo<C> cinfo)
Behaves the same as get( ContactInfo
|
C |
get(ContactInfo<C> cinfo,
ConnectionFinder<C> finder)
Return a Connection corresponding to the given ContactInfo.
|
int |
maxParallelConnections()
Configured maximum number of connections supported per ContactInfo.
|
void |
release(C conn,
int numResponseExpected)
Release a Connection previously obtained from get.
|
void |
responseReceived(C conn)
Inform the cache that a response has been received on a particular
connection.
|
close, getCacheType, highWaterMark, numberOfBusyConnections, numberOfConnections, numberOfIdleConnections, numberOfReclaimableConnections, numberToReclaimint maxParallelConnections()
boolean canCreateNewConnection(ContactInfo<C> cinfo)
C get(ContactInfo<C> cinfo, ConnectionFinder<C> finder) throws IOException
It is possible that the cache contains connections that no longer connect to their destination. In this case, it is the responsibility of the client of the cache to close the broken connection as they are detected. Connection reclamation may also handle the cleanup, but note that a broken connection with pending responses will never be reclaimed.
Note that the idle and busy connection collections that are passed to the finder are unmodifiable collections. They have iterators that return connections in LRU order, with the least recently used connection first. This is done to aid a finder that wishes to consider load balancing in its determination of an appropriate connection.
IOExceptionC get(ContactInfo<C> cinfo) throws IOException
IOExceptionvoid release(C conn, int numResponseExpected)
void responseReceived(C conn)
When a Connection is idle, and has no pending responses, it is eligible for reclamation.
Copyright © 2017–2019 Eclipse Foundation. All rights reserved.