in geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java [43:72]
public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
if (connectionInfo.isUnshareable()) {
next.getConnection(connectionInfo);
return;
}
ManagedConnectionInfo managedConnectionInfo = connections.get();
if (managedConnectionInfo != null) {
if (matchConnections) {
ManagedConnectionInfo mciRequest = connectionInfo.getManagedConnectionInfo();
if (null != managedConnectionInfo.getManagedConnectionFactory().matchManagedConnections(
Collections.singleton(managedConnectionInfo.getManagedConnection()),
mciRequest.getSubject(),
mciRequest.getConnectionRequestInfo()
)) {
connectionInfo.setManagedConnectionInfo(managedConnectionInfo);
return;
} else {
//match failed, get a new cx after returning this one
connections.set(null);
next.returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE);
}
} else {
connectionInfo.setManagedConnectionInfo(managedConnectionInfo);
return;
}
}
//nothing for this thread or match failed
next.getConnection(connectionInfo);
connections.set(connectionInfo.getManagedConnectionInfo());
}