File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
java/src/org/openqa/selenium/remote/http/jdk Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -511,15 +511,28 @@ public void close() {
511511 if (this .client == null ) {
512512 return ;
513513 }
514- this . client = null ;
514+
515515 for (WebSocket websocket : websockets ) {
516516 try {
517517 websocket .close ();
518518 } catch (Exception e ) {
519519 LOG .log (Level .WARNING , "failed to close the websocket: " + websocket , e );
520520 }
521521 }
522- executorService .shutdownNow ();
522+
523+ if (this .client instanceof AutoCloseable ) {
524+ AutoCloseable closeable = (AutoCloseable ) this .client ;
525+ executorService .submit (
526+ () -> {
527+ try {
528+ closeable .close ();
529+ } catch (Exception e ) {
530+ LOG .log (Level .WARNING , "failed to close the http client: " + closeable , e );
531+ }
532+ });
533+ }
534+ this .client = null ;
535+ executorService .shutdown ();
523536 }
524537
525538 @ AutoService (HttpClient .Factory .class )
You can’t perform that action at this time.
0 commit comments