mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-12-27 17:28:23 +01:00
Fix ThreadPoolExecutor queue, DependencyLoader unnecessary executor inside executor
This commit is contained in:
parent
a9fd9a9fc8
commit
061ab08e2d
@ -31,7 +31,6 @@ import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class DependencyLoader {
|
||||
@ -99,20 +98,8 @@ public class DependencyLoader {
|
||||
}
|
||||
|
||||
private CompletableFuture<Void> download(ClasspathAppender appender) {
|
||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
dependencyManager.downloadAll(executor, REPOSITORIES).join();
|
||||
dependencyManager.relocateAll(executor).join();
|
||||
dependencyManager.loadAll(executor, appender).join();
|
||||
|
||||
future.complete(null);
|
||||
} catch (CompletionException e) {
|
||||
future.completeExceptionally(e.getCause());
|
||||
} catch (Throwable t) {
|
||||
future.completeExceptionally(t);
|
||||
}
|
||||
});
|
||||
return future;
|
||||
return dependencyManager.downloadAll(executor, REPOSITORIES)
|
||||
.thenCompose(v -> dependencyManager.relocateAll(executor))
|
||||
.thenCompose(v -> dependencyManager.loadAll(executor, appender));
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class StandardScheduler implements Scheduler {
|
||||
Math.max(4, Runtime.getRuntime().availableProcessors() - 2),
|
||||
/* Timeout */
|
||||
60, TimeUnit.SECONDS,
|
||||
new SynchronousQueue<>(),
|
||||
new LinkedBlockingQueue<>(),
|
||||
new CountingThreadFactory(Scheduler.THREAD_NAME_PREFIX + "Executor #%s")
|
||||
),
|
||||
new ScheduledThreadPoolExecutor(
|
||||
|
Loading…
Reference in New Issue
Block a user