src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java
changeset 53300 54aa3ea04fe8
parent 52196 420445d16008
child 53387 c9622e15ba29
--- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java	Tue Jan 15 08:03:30 2019 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java	Tue Jan 15 11:34:20 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -242,7 +242,8 @@
                 result.complete(this.response);
             }
         });
-        return result;
+        // ensure that the connection is closed or returned to the pool.
+        return result.whenComplete(exch::nullBody);
     }
 
     private CompletableFuture<HttpResponse<T>>