Skip to content

Commit 8277240

Browse files
c-clearypull[bot]
authored andcommitted
8318492: Http2ClientImpl should attempt to close and remove connection in stop()
Reviewed-by: dfuchs, jpai
1 parent a7e21d3 commit 8277240

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ void stop() {
228228
connectionPoolLock.unlock();
229229
}
230230
do {
231-
connections.values().forEach(this::close);
231+
connections.values().removeIf(this::close);
232232
} while (!connections.isEmpty());
233233
}
234234

235-
private void close(Http2Connection h2c) {
235+
private boolean close(Http2Connection h2c) {
236236
// close all streams
237237
try { h2c.closeAllStreams(); } catch (Throwable t) {}
238238
// send GOAWAY
@@ -241,6 +241,8 @@ private void close(Http2Connection h2c) {
241241
try { h2c.shutdown(STOPPED); } catch (Throwable t) {}
242242
// double check and close any new streams
243243
try { h2c.closeAllStreams(); } catch (Throwable t) {}
244+
// Allows for use of removeIf in stop()
245+
return true;
244246
}
245247

246248
HttpClientImpl client() {

0 commit comments

Comments
 (0)