ConnectionTrackingInterceptor.java handles communication with the
CachedConnectionManager. On method call entry, cached handles are
checked for the correct Subject. On method call exit, cached
handles are disassociated if possible. On getting or releasing
a connection the CachedConnectionManager is notified.
Method from org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor Detail: |
public void enter(Collection connectionInfos) throws ResourceException {
for (Iterator i = connectionInfos.iterator(); i.hasNext();) {
ConnectionInfo connectionInfo = (ConnectionInfo) i.next();
next.getConnection(connectionInfo);
}
}
|
public void exit(Collection connectionInfos) throws ResourceException {
for (Iterator i = connectionInfos.iterator(); i.hasNext();) {
ConnectionInfo connectionInfo = (ConnectionInfo) i.next();
if (connectionInfo.isUnshareable()) {
//if one is, they all are
return;
}
ManagedConnectionInfo managedConnectionInfo = connectionInfo.getManagedConnectionInfo();
ManagedConnection managedConnection = managedConnectionInfo.getManagedConnection();
if (managedConnection instanceof DissociatableManagedConnection
&& managedConnectionInfo.isFirstConnectionInfo(connectionInfo)) {
int size = connectionInfos.size();
i.remove();
assert size - 1 == connectionInfos.size();
((DissociatableManagedConnection) managedConnection).dissociateConnections();
managedConnectionInfo.clearConnectionHandles();
//todo this needs some kind of check so cx isn't returned more than once
//in case dissociate calls connection closed event and returns cx to pool.
returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE);
}
}
}
|
public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
connectionTracker.setEnvironment(connectionInfo, key);
next.getConnection(connectionInfo);
connectionTracker.handleObtained(this, connectionInfo);
}
called by: GenericConnectionManager.allocateConnection, GenericConnectionManager.associateConnection, and enter.
in: connectionInfo is non-null, and has non-null ManagedConnectionInfo with non-null managedConnectionfactory.
connection handle may or may not be null.
out: connectionInfo has non-null connection handle, non null ManagedConnectionInfo with non-null ManagedConnection and GeronimoConnectionEventListener.
connection tracker has been notified of handle-managed connection association. |
public void returnConnection(ConnectionInfo connectionInfo,
ConnectionReturnAction connectionReturnAction) {
connectionTracker.handleReleased(this, connectionInfo);
next.returnConnection(connectionInfo, connectionReturnAction);
}
called by: GeronimoConnectionEventListener.connectionClosed, GeronimoConnectionEventListener.connectionErrorOccurred, exit
in: handle has already been dissociated from ManagedConnection. connectionInfo not null, has non-null ManagedConnectionInfo, ManagedConnectionInfo has non-null ManagedConnection
handle can be null if called from error in ManagedConnection in pool.
out: connectionTracker has been notified, ManagedConnectionInfo null. |