Skip to content

Commit cf24765

Browse files
committed
Fix NPE on partitionKey when maxConnectionsPerHost is enabled, close AsyncHttpClient#900
1 parent c5200eb commit cf24765

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/main/java/com/ning/http/client/providers/netty/request/NettyRequestSender.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,11 @@ private <T> ListenableFuture<T> sendRequestWithNewChannel(//
266266
ClientBootstrap bootstrap = channelManager.getBootstrap(request.getUri().getScheme(), useProxy, useSSl);
267267

268268
boolean channelPreempted = false;
269-
Object partitionKey = null;
269+
Object partitionKey = future.getPartitionKey();
270270

271271
try {
272272
// Do not throw an exception when we need an extra connection for a redirect.
273273
if (!reclaimCache) {
274-
// only compute when maxConnectionPerHost is enabled
275-
// FIXME clean up
276-
if (config.getMaxConnectionsPerHost() > 0)
277-
partitionKey = future.getPartitionKey();
278274
channelManager.preemptChannel(partitionKey);
279275
channelPreempted = true;
280276
}

0 commit comments

Comments
 (0)