Methods Summary |
---|
public synchronized void | close(C conn)Close a connection, regardless of whether the connection is busy
or not.
if (debug())
dprint( "->close: " + conn ) ;
try {
final ConnectionState<C> cs = connectionMap.remove( conn ) ;
int count = cs.busyCount ;
if (debug())
dprint( ".close: " + conn + " count = " + count ) ;
if (count == 0)
totalIdle-- ;
else
totalBusy-- ;
final ConcurrentQueue.Handle rh = cs.reclaimableHandle ;
if (rh != null) {
if (debug())
dprint( ".close: " + conn + " connection was reclaimable" ) ;
rh.remove() ;
}
try {
conn.close() ;
} catch (IOException exc) {
if (debug())
dprint( ".close: " + conn + " close threw " + exc ) ;
}
} finally {
if (debug())
dprint( "<-close: " + conn ) ;
}
|
private com.sun.xml.ws.transport.tcp.connectioncache.impl.transport.InboundConnectionCacheBlockingImpl$ConnectionState | getConnectionState(C conn)
// This should be the only place a CacheEntry is constructed.
if (debug())
dprint( "->getConnectionState: " + conn ) ;
try {
ConnectionState<C> result = connectionMap.get( conn ) ;
if (result == null) {
if (debug())
dprint( ".getConnectionState: " + conn +
" creating new ConnectionState instance" ) ;
result = new ConnectionState<C>( conn ) ;
connectionMap.put( conn, result ) ;
totalIdle++ ;
}
return result ;
} finally {
if (debug())
dprint( "<-getConnectionState: " + conn ) ;
}
|
public synchronized void | requestProcessed(C conn, int numResponsesExpected)
if (debug())
dprint( "->requestProcessed: connection " + conn
+ " expecting " + numResponsesExpected + " responses" ) ;
try {
final ConnectionState<C> cs = connectionMap.get( conn ) ;
if (cs == null) {
if (debug())
dprint( ".release: connection " + conn + " was closed" ) ;
return ;
} else {
cs.expectedResponseCount += numResponsesExpected ;
int numResp = cs.expectedResponseCount ;
int numBusy = --cs.busyCount ;
if (debug()) {
dprint( ".release: " + numResp + " responses expected" ) ;
dprint( ".release: " + numBusy +
" busy count for connection" ) ;
}
if (numBusy == 0) {
totalBusy-- ;
totalIdle++ ;
if (numResp == 0) {
if (debug())
dprint( ".release: "
+ "queuing reclaimable connection "
+ conn ) ;
if ((totalBusy+totalIdle) > highWaterMark()) {
close( conn ) ;
} else {
cs.reclaimableHandle =
reclaimableConnections.offer( conn ) ;
}
}
}
}
} finally {
if (debug())
dprint( "<-requestProcessed" ) ;
}
|
public synchronized void | requestReceived(C conn)
if (debug())
dprint( "->requestReceived: connection " + conn ) ;
try {
ConnectionState<C> cs = getConnectionState( conn ) ;
final int totalConnections = totalBusy + totalIdle ;
if (totalConnections > highWaterMark())
reclaim() ;
ConcurrentQueue.Handle<C> reclaimHandle = cs.reclaimableHandle ;
if (reclaimHandle != null) {
if (debug())
dprint( ".requestReceived: " + conn
+ " removed from reclaimableQueue" ) ;
reclaimHandle.remove() ;
}
int count = cs.busyCount++ ;
if (count == 0) {
if (debug())
dprint( ".requestReceived: " + conn
+ " transition from idle to busy" ) ;
totalIdle-- ;
totalBusy++ ;
}
} finally {
if (debug())
dprint( "<-requestReceived: connection " + conn ) ;
}
|
public synchronized void | responseSent(C conn)Decrement the number of expected responses. When a connection is idle
and has no expected responses, it can be reclaimed.
if (debug())
dprint( "->responseSent: " + conn ) ;
try {
final ConnectionState<C> cs = connectionMap.get( conn ) ;
final int waitCount = --cs.expectedResponseCount ;
if (waitCount == 0) {
if (debug())
dprint( ".responseSent: " + conn + " is now reclaimable" ) ;
if ((totalBusy+totalIdle) > highWaterMark()) {
if (debug()) {
dprint( ".responseSent: " + conn
+ " closing connection" ) ;
}
close( conn ) ;
} else {
cs.reclaimableHandle =
reclaimableConnections.offer( conn ) ;
if (debug()) {
dprint( ".responseSent: " + conn
+ " is now reclaimable" ) ;
}
}
} else {
if (debug()) {
dprint( ".responseSent: " + conn + " waitCount="
+ waitCount ) ;
}
}
} finally {
if (debug()) {
dprint( "<-responseSent: " + conn ) ;
}
}
|
protected java.lang.String | thisClassName()
return "InboundConnectionCacheBlockingImpl" ;
|