From 6771fd491b2d971c6e97429139cb9d6558a59ccc Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 1 Jun 2021 21:32:57 +0100 Subject: Close okhttp threads on shutdown --- spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spark-common/src/main/java/me/lucko/spark') diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index fdced75..4dfbd20 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -160,6 +160,11 @@ public class SparkPlatform { } SparkApi.unregister(); + + // shutdown okhttp + // see: https://github.com/square/okhttp/issues/4029 + OK_HTTP_CLIENT.dispatcher().executorService().shutdown(); + OK_HTTP_CLIENT.connectionPool().evictAll(); } public SparkPlugin getPlugin() { -- cgit