From ec5ba8b41a1275820606519311c6dd1e459a68e3 Mon Sep 17 00:00:00 2001 From: gsd Date: Fri, 24 Feb 2023 22:13:25 +0300 Subject: [PATCH] fix not created threads --- src/main/java/app/updates/BaseUpdater.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/app/updates/BaseUpdater.java b/src/main/java/app/updates/BaseUpdater.java index eeb425a..7860490 100644 --- a/src/main/java/app/updates/BaseUpdater.java +++ b/src/main/java/app/updates/BaseUpdater.java @@ -2,6 +2,7 @@ package app.updates; import java.util.concurrent.Callable; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executors; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; @@ -9,10 +10,10 @@ import java.util.function.Supplier; public abstract class BaseUpdater { public void CreateTaskUpdater(Supplier function, int timeout) { System.out.printf("Create task: %s, update after %d sec\n", function.toString(), timeout / 1000); - CompletableFuture.supplyAsync(() -> { + Executors.newFixedThreadPool(1).submit(() -> { while (true) { try { - System.out.printf("Call: %s\n", function.toString()); + //System.out.printf("Call: %s\n", function.toString()); function.get(); } catch (Exception err) { err.printStackTrace();