From 7b2ac41879f867e8ad6e123eb37fea73aa970e0b Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Sat, 18 Mar 2023 18:52:04 +0000 Subject: [PATCH] Revert to using a regular cached executor. --- src/main/java/me/kavin/piped/utils/Multithreading.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/Multithreading.java b/src/main/java/me/kavin/piped/utils/Multithreading.java index 2b0625a..ccc54fd 100644 --- a/src/main/java/me/kavin/piped/utils/Multithreading.java +++ b/src/main/java/me/kavin/piped/utils/Multithreading.java @@ -1,13 +1,13 @@ package me.kavin.piped.utils; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.function.Supplier; public class Multithreading { - private static final ExecutorService es = Executors.newVirtualThreadPerTaskExecutor(); + private static final ExecutorService es = Executors.newCachedThreadPool(); private static final ExecutorService esLimited = Executors .newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8); private static final ExecutorService esLimitedPubSub = Executors @@ -29,7 +29,7 @@ public class Multithreading { return es; } - public static CompletableFuture supplyAsync(Supplier supplier) { - return CompletableFuture.supplyAsync(supplier, es); + public static Future supplyAsync(Supplier supplier) { + return es.submit(supplier::get); } }