11/*
2- * Copyright (c) 2015, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2015, 2023 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
4444
4545import jdk .internal .net .http .common .Deadline ;
4646import jdk .internal .net .http .common .FlowTube ;
47- import jdk .internal .net .http .common .Log ;
4847import jdk .internal .net .http .common .Logger ;
4948import jdk .internal .net .http .common .TimeLine ;
5049import jdk .internal .net .http .common .TimeSource ;
@@ -493,13 +492,13 @@ void clear() {
493492
494493 // Remove a connection from the pool.
495494 // should only be called while holding the ConnectionPool stateLock.
496- private boolean removeFromPool (HttpConnection c ) {
495+ private void removeFromPool (HttpConnection c ) {
497496 assert stateLock .isHeldByCurrentThread ();
498497 if (c instanceof PlainHttpConnection ) {
499- return removeFromPool (c , plainPool );
498+ removeFromPool (c , plainPool );
500499 } else {
501500 assert c .isSecure () : "connection " + c + " is not secure!" ;
502- return removeFromPool (c , sslPool );
501+ removeFromPool (c , sslPool );
503502 }
504503 }
505504
@@ -530,29 +529,13 @@ void cleanup(HttpConnection c, Throwable error) {
530529 debug .log ("%s : ConnectionPool.cleanup(%s)" ,
531530 String .valueOf (c .getConnectionFlow ()), error );
532531 stateLock .lock ();
533- boolean removed ;
534532 try {
535- removed = removeFromPool (c );
533+ removeFromPool (c );
536534 expiryList .remove (c );
537535 } finally {
538536 stateLock .unlock ();
539537 }
540- if (!removed ) {
541- // this should not happen; the cleanup may have consumed
542- // some data that wasn't supposed to be consumed, so
543- // the only thing we can do is log it and close the
544- // connection.
545- if (Log .errors ()) {
546- Log .logError ("WARNING: CleanupTrigger triggered for" +
547- " a connection not found in the pool: closing {0}" , c );
548- } else if (debug .on ()) {
549- debug .log ("WARNING: CleanupTrigger triggered for" +
550- " a connection not found in the pool: closing %s" , c );
551- }
552- c .close (new IOException ("Unexpected cleanup triggered for non pooled connection" ));
553- } else {
554- c .close ();
555- }
538+ c .close ();
556539 }
557540
558541 /**
@@ -566,7 +549,6 @@ private final class CleanupTrigger implements
566549
567550 private final HttpConnection connection ;
568551 private volatile boolean done ;
569- private volatile boolean dropped ;
570552
571553 public CleanupTrigger (HttpConnection connection ) {
572554 this .connection = connection ;
@@ -584,7 +566,6 @@ private void triggerCleanup(Throwable error) {
584566
585567 @ Override
586568 public void onSubscribe (Flow .Subscription subscription ) {
587- if (dropped || done ) return ;
588569 subscription .request (1 );
589570 }
590571 @ Override
@@ -605,10 +586,5 @@ public void subscribe(Flow.Subscriber<? super List<ByteBuffer>> subscriber) {
605586 public String toString () {
606587 return "CleanupTrigger(" + connection .getConnectionFlow () + ")" ;
607588 }
608-
609- @ Override
610- public void dropSubscription () {
611- dropped = true ;
612- }
613589 }
614590}
0 commit comments