|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.connectioncache.impl.transport.ConnectionCacheBase<C>
com.sun.grizzly.connectioncache.impl.transport.OutboundConnectionCacheBlockingImpl<C>
public final class OutboundConnectionCacheBlockingImpl<C extends Closeable>
Field Summary | |
---|---|
protected int |
totalBusy
|
protected int |
totalIdle
|
Fields inherited from class com.sun.grizzly.connectioncache.impl.transport.ConnectionCacheBase |
---|
logger, reclaimableConnections |
Constructor Summary | |
---|---|
OutboundConnectionCacheBlockingImpl(String cacheType,
int highWaterMark,
int numberToReclaim,
int maxParallelConnections,
Logger logger)
|
Method Summary | |
---|---|
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. |
com.sun.grizzly.connectioncache.impl.transport.OutboundConnectionCacheBlockingImpl.ConnectionState<C> |
getConnectionState(ContactInfo<C> cinfo,
com.sun.grizzly.connectioncache.impl.transport.OutboundConnectionCacheBlockingImpl.CacheEntry<C> entry,
C conn)
|
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()
|
Methods inherited from class com.sun.grizzly.connectioncache.impl.transport.ConnectionCacheBase |
---|
debug, dprint, dprintStatistics, getCacheType, highWaterMark, numberToReclaim, reclaim, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.sun.grizzly.connectioncache.spi.transport.ConnectionCache |
---|
getCacheType, highWaterMark, numberOfBusyConnections, numberOfConnections, numberOfIdleConnections, numberOfReclaimableConnections, numberToReclaim |
Field Detail |
---|
protected int totalBusy
protected int totalIdle
Constructor Detail |
---|
public OutboundConnectionCacheBlockingImpl(String cacheType, int highWaterMark, int numberToReclaim, int maxParallelConnections, Logger logger)
Method Detail |
---|
public int maxParallelConnections()
OutboundConnectionCache
maxParallelConnections
in interface OutboundConnectionCache<C extends Closeable>
ContactInfo
protected String thisClassName()
thisClassName
in class ConnectionCacheBase<C extends Closeable>
public boolean canCreateNewConnection(ContactInfo<C> cinfo)
OutboundConnectionCache
canCreateNewConnection
in interface OutboundConnectionCache<C extends Closeable>
cinfo
- a ContactInfo
ConnectionCache
, otherwise false.public C get(ContactInfo<C> cinfo) throws IOException
OutboundConnectionCache
get
in interface OutboundConnectionCache<C extends Closeable>
cinfo
- a ContactInfo
IOException
public com.sun.grizzly.connectioncache.impl.transport.OutboundConnectionCacheBlockingImpl.ConnectionState<C> getConnectionState(ContactInfo<C> cinfo, com.sun.grizzly.connectioncache.impl.transport.OutboundConnectionCacheBlockingImpl.CacheEntry<C> entry, C conn)
public C get(ContactInfo<C> cinfo, ConnectionFinder<C> finder) throws IOException
OutboundConnectionCache
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.
get
in interface OutboundConnectionCache<C extends Closeable>
cinfo
- a ContactInfo
finder
- a ConnectionFinder
IOException
public void release(C conn, int numResponsesExpected)
OutboundConnectionCache
release
in interface OutboundConnectionCache<C extends Closeable>
conn
- a connectionnumResponsesExpected
- number of connections in which a response is expectedpublic void responseReceived(C conn)
responseReceived
in interface OutboundConnectionCache<C extends Closeable>
conn
- a connectionpublic void close(C conn)
close
in interface ConnectionCache<C extends Closeable>
conn
- a connectionpublic long numberOfConnections()
ConnectionCache
public long numberOfIdleConnections()
ConnectionCache
public long numberOfBusyConnections()
ConnectionCache
public long numberOfReclaimableConnections()
ConnectionCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |