public void preemptChannel(Object partitionKey) throws IOException { if (!channelPool.isOpen()) throw poolAlreadyClosed; if (!tryAcquireGlobal()) throw tooManyConnections; if (!tryAcquirePerHost(partitionKey)) { if (maxTotalConnectionsEnabled) freeChannels.release(); throw tooManyConnectionsPerHost; } }
public boolean preemptChannel(String poolKey) { return channelPool.isOpen() && tryAcquireGlobal() && tryAcquirePerHost(poolKey); }