]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/GeneralBackgroundTasks.java
use a fixed thread pool for general short tasks
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / GeneralBackgroundTasks.java
index 438391ff5e44b652f609f4d540c06638e4d07160..3ff5904296a9bc9ce359e53f2c8a21ad1af21efb 100644 (file)
@@ -25,8 +25,12 @@ import org.jetbrains.annotations.Nullable;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 
+/**
+ * suitable for short tasks, not involving network communication
+ */
 public class GeneralBackgroundTasks {
-    private static final Executor runner = Executors.newCachedThreadPool();
+    private static final Executor runner = Executors.newFixedThreadPool(Runtime.getRuntime()
+                                                                               .availableProcessors());
     public static void run(@NotNull Runnable runnable) {
         runner.execute(runnable);
     }