Download executor

This commit is contained in:
M66B
2022-12-28 10:32:41 +01:00
parent fe42eba34d
commit c8fe17b296
5 changed files with 38 additions and 33 deletions

View File

@@ -245,12 +245,13 @@ public class Helper {
"wsc", "wsf", "wsh"
));
static ExecutorService sSerialExecutor = null;
static ExecutorService sParallelExecutor = null;
static ExecutorService sSerialTaskExecutor = null;
private static ExecutorService sSerialExecutor = null;
private static ExecutorService sParallelExecutor = null;
private static ExecutorService sSerialTaskExecutor = null;
private static ExecutorService sDownloadExecutor = null;
static int sOperationIndex = 0;
static final ExecutorService[] sOperationExecutor = new ExecutorService[OPERATION_WORKERS];
private static int sOperationIndex = 0;
private static final ExecutorService[] sOperationExecutor = new ExecutorService[OPERATION_WORKERS];
static ExecutorService getSerialExecutor() {
if (sSerialExecutor == null)
@@ -270,6 +271,12 @@ public class Helper {
return sSerialTaskExecutor;
}
static ExecutorService getDownloadTaskExecutor() {
if (sDownloadExecutor == null)
sDownloadExecutor = getBackgroundExecutor(0, "download");
return sDownloadExecutor;
}
static ExecutorService getOperationExecutor() {
synchronized (sOperationExecutor) {
if (sOperationExecutor[sOperationIndex] == null)