src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java
changeset 53300 54aa3ea04fe8
parent 52196 420445d16008
child 53387 c9622e15ba29
equal deleted inserted replaced
53299:0b2574a2a6c7 53300:54aa3ea04fe8
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   240                 this.response =
   240                 this.response =
   241                         new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch);
   241                         new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch);
   242                 result.complete(this.response);
   242                 result.complete(this.response);
   243             }
   243             }
   244         });
   244         });
   245         return result;
   245         // ensure that the connection is closed or returned to the pool.
       
   246         return result.whenComplete(exch::nullBody);
   246     }
   247     }
   247 
   248 
   248     private CompletableFuture<HttpResponse<T>>
   249     private CompletableFuture<HttpResponse<T>>
   249     responseAsync0(CompletableFuture<Void> start) {
   250     responseAsync0(CompletableFuture<Void> start) {
   250         return start.thenCompose( v -> responseAsyncImpl())
   251         return start.thenCompose( v -> responseAsyncImpl())