mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-12-28 17:37:52 +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.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
public class DependencyLoader {
|
public class DependencyLoader {
|
||||||
@ -99,20 +98,8 @@ public class DependencyLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Void> download(ClasspathAppender appender) {
|
private CompletableFuture<Void> download(ClasspathAppender appender) {
|
||||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
return dependencyManager.downloadAll(executor, REPOSITORIES)
|
||||||
executor.execute(() -> {
|
.thenCompose(v -> dependencyManager.relocateAll(executor))
|
||||||
try {
|
.thenCompose(v -> dependencyManager.loadAll(executor, appender));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class StandardScheduler implements Scheduler {
|
|||||||
Math.max(4, Runtime.getRuntime().availableProcessors() - 2),
|
Math.max(4, Runtime.getRuntime().availableProcessors() - 2),
|
||||||
/* Timeout */
|
/* Timeout */
|
||||||
60, TimeUnit.SECONDS,
|
60, TimeUnit.SECONDS,
|
||||||
new SynchronousQueue<>(),
|
new LinkedBlockingQueue<>(),
|
||||||
new CountingThreadFactory(Scheduler.THREAD_NAME_PREFIX + "Executor #%s")
|
new CountingThreadFactory(Scheduler.THREAD_NAME_PREFIX + "Executor #%s")
|
||||||
),
|
),
|
||||||
new ScheduledThreadPoolExecutor(
|
new ScheduledThreadPoolExecutor(
|
||||||
|
Loading…
Reference in New Issue
Block a user