From 66c28b6f52f97f5d07ebb5e03412f928d8d13659 Mon Sep 17 00:00:00 2001 From: Artem Medeu Date: Wed, 5 Jun 2024 19:54:50 +0500 Subject: [PATCH] fix: fails to eval/compile on JVM version <19 --- src/k16/ok_http.clj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/k16/ok_http.clj b/src/k16/ok_http.clj index 76d55a7..d4a34a9 100644 --- a/src/k16/ok_http.clj +++ b/src/k16/ok_http.clj @@ -135,7 +135,11 @@ (let [client-builder (OkHttpClient$Builder.) dispatcher' (or dispatcher (when virtual-threads-available? - (Dispatcher. (Executors/newVirtualThreadPerTaskExecutor))))] + (-> Executors + (.getMethod "newVirtualThreadPerTaskExecutor" + (into-array Class [])) + (.invoke nil (into-array [])) + (Dispatcher.))))] (set-options! client-builder (assoc options :dispatcher dispatcher')) (.build client-builder))))