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() {
511
511
if (this .client == null ) {
512
512
return ;
513
513
}
514
- this . client = null ;
514
+
515
515
for (WebSocket websocket : websockets ) {
516
516
try {
517
517
websocket .close ();
518
518
} catch (Exception e ) {
519
519
LOG .log (Level .WARNING , "failed to close the websocket: " + websocket , e );
520
520
}
521
521
}
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 ();
523
536
}
524
537
525
538
@ AutoService (HttpClient .Factory .class )
You can’t perform that action at this time.
0 commit comments