Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 39535bd

Browse files
committed
[WIP] attempt to shutdown OKHTTP when shutting down ldclient
1 parent acd7428 commit 39535bd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/com/launchdarkly/client/LDClient.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ public void close() throws IOException {
377377
if (this.updateProcessor != null) {
378378
this.updateProcessor.close();
379379
}
380+
if (this.config.httpClient != null) {
381+
if (this.config.httpClient.dispatcher() != null && this.config.httpClient.dispatcher().executorService() != null) {
382+
this.config.httpClient.dispatcher().executorService().shutdown();
383+
}
384+
if (this.config.httpClient.connectionPool() != null) {
385+
this.config.httpClient.connectionPool().evictAll();
386+
}
387+
if (this.config.httpClient.cache() != null) {
388+
this.config.httpClient.cache().close();
389+
}
390+
}
380391
}
381392

382393
/**

0 commit comments

Comments
 (0)