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

Commit 825472b

Browse files
author
Dan Richelson
committed
Enable faster shutdown of okhttp and okio resources.
1 parent 4af9bfe commit 825472b

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=2.2.5
1+
version=2.2.6-SNAPSHOT
22
ossrhUsername=
33
ossrhPassword=

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ public void close() throws IOException {
379379
}
380380
if (this.config.httpClient != null) {
381381
if (this.config.httpClient.dispatcher() != null && this.config.httpClient.dispatcher().executorService() != null) {
382-
this.config.httpClient.dispatcher().executorService().shutdown();
382+
this.config.httpClient.dispatcher().cancelAll();
383+
this.config.httpClient.dispatcher().executorService().shutdownNow();
383384
}
384385
if (this.config.httpClient.connectionPool() != null) {
385386
this.config.httpClient.connectionPool().evictAll();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected LDConfig(Builder builder) {
9090

9191
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder()
9292
.cache(cache)
93-
.connectionPool(new ConnectionPool(5, 5, TimeUnit.MINUTES))
93+
.connectionPool(new ConnectionPool(5, 5, TimeUnit.SECONDS))
9494
.connectTimeout(connectTimeoutMillis, TimeUnit.MILLISECONDS)
9595
.readTimeout(socketTimeoutMillis, TimeUnit.MILLISECONDS)
9696
.writeTimeout(socketTimeoutMillis, TimeUnit.MILLISECONDS)

0 commit comments

Comments
 (0)