This commit is contained in:
Glavo 2024-02-06 17:16:23 +08:00 committed by GitHub
parent bc4aa43834
commit 59ab49e0c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -301,9 +301,16 @@ public abstract class FetchTask<T> extends Task<T> {
concurrency = Math.max(concurrency, 1);
synchronized (Schedulers.class) {
downloadExecutorConcurrency = concurrency;
if (DOWNLOAD_EXECUTOR != null) {
DOWNLOAD_EXECUTOR.setCorePoolSize(concurrency);
DOWNLOAD_EXECUTOR.setMaximumPoolSize(concurrency);
ThreadPoolExecutor downloadExecutor = DOWNLOAD_EXECUTOR;
if (downloadExecutor != null) {
if (downloadExecutor.getMaximumPoolSize() <= concurrency) {
downloadExecutor.setMaximumPoolSize(concurrency);
downloadExecutor.setCorePoolSize(concurrency);
} else {
downloadExecutor.setCorePoolSize(concurrency);
downloadExecutor.setMaximumPoolSize(concurrency);
}
}
}
}