next.getConnection(connectionInfo);
} else {
Subject oldSubject = originalManagedConnectionInfo.getSubject();
if (currentSubject == null ? oldSubject != null : !currentSubject.equals(oldSubject)) {
if (connectionInfo.isUnshareable()) {
throw new ApplicationServerInternalException("Unshareable resource is attempting to change security context: expected request under: " + oldSubject + ", received request under: " + currentSubject);
} else {
//existing managed connection, wrong subject: must re-associate.
//make a ConnectionInfo to process removing the handle from the old mc
ConnectionInfo returningConnectionInfo = new ConnectionInfo();
returningConnectionInfo.setManagedConnectionInfo(originalManagedConnectionInfo);