// We fall out of the loop once we aquire a permit to open a connection to the server.
} while (!maxOpenConnections.attempt(100));
} catch (InterruptedException e1) {
throw new TransportException("(" + remoteURI + "): " + e1);
}
// not available, make one on demand
try {
log.debug("channel connecting to: " + remoteURI);
PooledAsynchChannel c = new PooledAsynchChannel(TransportFactory.instance.createAsynchChannel());
c.open(remoteURI, backConnectURI);
return c;
} catch (Exception e) {
// return the aquired permit.
maxOpenConnections.release();
log.debug("Connect Failed: ", e);
if (log.isDebugEnabled()) {
log.debug("channel connection to: " + remoteURI + " failed", e);
}
throw new TransportException("(" + remoteURI + "): " + e);
}
}