return null; // the other connect will be called later
}
boolean checkedResolvePermission = false;
for (Iterator i = configList.iterator(); i.hasNext(); ) {
Config config = (Config) i.next();
for (Iterator j = active.iterator(); j.hasNext(); ) {
ConnectionImpl c = checkConnection(j.next());
if (c.satisfies(config)) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "found an active " +
"connection for reusing:\n{0}\n{1}",
new Object[] {c, config});
}
if (!checkedResolvePermission) {
try {
checkResolvePermission();
} catch (SecurityException e) {
if (logger.isLoggable(Levels.FAILED)) {
LogUtil.logThrow(logger, Levels.FAILED,
ConnectionEndpointImpl.class, "connect",
"exception resolving host {0}",
new Object[] { serverHost }, e);
}
throw e;
}
checkedResolvePermission = true;
}
try {
c.checkConnectPermission();
return c;
} catch (SecurityException e) {
if (logger.isLoggable(Levels.HANDLED)) {
LogUtil.logThrow(logger, Levels.HANDLED,
ConnectionEndpointImpl.class, "connect",
"access to reuse connection {0} denied",
new Object[] { c.sock }, e);
}
}
}
}
}
for (Iterator i = configList.iterator(); i.hasNext(); ) {
Config config = (Config) i.next();
for (Iterator j = idle.iterator(); j.hasNext(); ) {
ConnectionImpl c = checkConnection(j.next());
if (c.switchTo(config)) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "found an idle " +