@ManagedObject @Description(value="Outbound connection cache for connections opened by the client") public final class OutboundConnectionCacheBlockingImpl<C extends Connection> extends ConnectionCacheBase<C> implements OutboundConnectionCache<C>
| Modifier and Type | Field and Description |
|---|---|
protected int |
totalBusy |
protected int |
totalIdle |
reclaimableConnections| Constructor and Description |
|---|
OutboundConnectionCacheBlockingImpl(String cacheType,
int highWaterMark,
int numberToReclaim,
int maxParallelConnections,
long ttl) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canCreateNewConnection(ContactInfo<C> cinfo)
Determine whether a new connection could be created by the
ConnectionCache or not.
|
void |
close(C conn)
Close a connection, regardless of whether the connection is busy
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.
|
long |
numberOfBusyConnections()
Number of non-idle connections.
|
long |
numberOfConnections()
Total number of connections currently managed by the cache.
|
long |
numberOfIdleConnections()
Number of idle connections; that is, connections for which the number of
get/release or responseReceived/responseProcessed calls are equal.
|
long |
numberOfReclaimableConnections()
Number of idle connections that are reclaimable.
|
void |
release(C conn,
int numResponsesExpected)
Release a Connection previously obtained from get.
|
void |
responseReceived(C conn)
Decrement the number of expected responses.
|
protected String |
thisClassName() |
getCacheType, highWaterMark, numberToReclaim, reclaim, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCacheType, highWaterMark, numberOfBusyConnections, numberOfConnections, numberOfIdleConnections, numberOfReclaimableConnections, numberToReclaimpublic OutboundConnectionCacheBlockingImpl(String cacheType, int highWaterMark, int numberToReclaim, int maxParallelConnections, long ttl)
@ManagedAttribute public int maxParallelConnections()
OutboundConnectionCachemaxParallelConnections in interface OutboundConnectionCache<C extends Connection>protected String thisClassName()
thisClassName in class ConnectionCacheBase<C extends Connection>public boolean canCreateNewConnection(ContactInfo<C> cinfo)
OutboundConnectionCachecanCreateNewConnection in interface OutboundConnectionCache<C extends Connection>public C get(ContactInfo<C> cinfo) throws IOException
OutboundConnectionCacheget in interface OutboundConnectionCache<C extends Connection>IOExceptionpublic C get(ContactInfo<C> cinfo, ConnectionFinder<C> finder) throws IOException
OutboundConnectionCacheIt 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.
get in interface OutboundConnectionCache<C extends Connection>IOExceptionpublic void release(C conn, int numResponsesExpected)
OutboundConnectionCacherelease in interface OutboundConnectionCache<C extends Connection>public void responseReceived(C conn)
responseReceived in interface OutboundConnectionCache<C extends Connection>public void close(C conn)
close in interface ConnectionCache<C extends Connection>public long numberOfConnections()
ConnectionCachepublic long numberOfIdleConnections()
ConnectionCachepublic long numberOfBusyConnections()
ConnectionCachepublic long numberOfReclaimableConnections()
ConnectionCacheCopyright © 2017–2019 Eclipse Foundation. All rights reserved.