Limit simple task thread to number of processors

This commit is contained in:
M66B 2019-01-18 20:07:56 +00:00
parent 4d9330e60b
commit 522f13a38c
1 changed files with 2 additions and 1 deletions

View File

@ -49,7 +49,8 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
private String name;
private Result stored;
private static ExecutorService executor = Executors.newCachedThreadPool(Helper.backgroundThreadFactory);
private static ExecutorService executor = Executors.newFixedThreadPool(
Runtime.getRuntime().availableProcessors(), Helper.backgroundThreadFactory);
public void execute(Context context, LifecycleOwner owner, Bundle args, String name) {
run(context, owner, args, name);