Skip to content

Commit

Permalink
ChannelManager.preemptChannel should release global semaphore if tryA…
Browse files Browse the repository at this point in the history
…cquirePerHost fails, close #805
  • Loading branch information
Stephane Landelle committed Jan 15, 2015
1 parent 29a76ec commit 8c0ad2a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,12 @@ public void preemptChannel(String poolKey) throws IOException {
throw poolAlreadyClosed;
if (!tryAcquireGlobal())
throw tooManyConnections;
if (!tryAcquirePerHost(poolKey))
if (!tryAcquirePerHost(poolKey)) {
if (maxTotalConnectionsEnabled)
freeChannels.release();

throw tooManyConnectionsPerHost;
}
}

public void close() {
Expand Down

0 comments on commit 8c0ad2a

Please sign in to comment.