public final class InboundConnectionCacheImpl<C extends Connection> extends ConnectionCacheBase<C> implements InboundConnectionCache<C>
A connection basically represents some sort of communication channel, but few requirements are placed on the connection. Basically the ability to close a connection is required in order for reclamation to work.
| Modifier and Type | Field and Description |
|---|---|
protected AtomicInteger |
totalBusy |
protected AtomicInteger |
totalIdle |
reclaimableConnections| Constructor and Description |
|---|
InboundConnectionCacheImpl(String cacheType,
int highWaterMark,
int numberToReclaim,
long ttl) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(C conn)
Close a connection, regardless of whether the connection is busy
or not.
|
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 |
requestProcessed(C conn,
int numResponsesExpected)
Indicate that request processing has been completed for a request
received on conn.
|
void |
requestReceived(C conn)
Mark a connection as busy because a request is being processed
on the connection.
|
void |
responseSent(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, numberToReclaimprotected final AtomicInteger totalBusy
protected final AtomicInteger totalIdle
public InboundConnectionCacheImpl(String cacheType, int highWaterMark, int numberToReclaim, long ttl)
protected String thisClassName()
thisClassName in class ConnectionCacheBase<C extends Connection>public void requestReceived(C conn)
InboundConnectionCacheNote that this problem is inherent in a distributed system. We could in any case reclaim a connection AFTER a client has sent a request but BEFORE the request is received. Note that AFTER and BEFORE refer to global time which does not really exist in a distributed system (or at least we want to pretend it is not available). XXX Should we age out connections? This would require actual time stamps, rather than just an LRU queue.
requestReceived in interface InboundConnectionCache<C extends Connection>public void requestProcessed(C conn, int numResponsesExpected)
InboundConnectionCacherequestProcessed in interface InboundConnectionCache<C extends Connection>public void responseSent(C conn)
responseSent in interface InboundConnectionCache<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.