alt: rename natives directory

This commit is contained in:
huanghongxun 2020-02-22 23:13:52 +08:00
parent fb4a499fe9
commit 1ca4045a2f
3 changed files with 7 additions and 27 deletions

View File

@ -54,10 +54,6 @@ public final class DownloadProviders {
() -> Optional.ofNullable(providersById.get(config().getDownloadType()))
.orElse(providersById.get(DEFAULT_PROVIDER_ID)),
config().downloadTypeProperty());
FXUtils.onChangeAndOperate(downloadProviderProperty, provider -> {
Schedulers.io().setMaximumPoolSize(provider.getConcurrency());
});
}
/**

View File

@ -118,7 +118,7 @@ public class DefaultGameRepository implements GameRepository {
@Override
public File getNativeDirectory(String id) {
return new File(getVersionRoot(id), id + "-natives");
return new File(getVersionRoot(id), "natives");
}
@Override

View File

@ -42,35 +42,22 @@ public final class Schedulers {
return CACHED_EXECUTOR;
}
private static volatile ThreadPoolExecutor IO_EXECUTOR;
private static volatile ExecutorService IO_EXECUTOR;
public static synchronized ThreadPoolExecutor io() {
if (IO_EXECUTOR == null)
IO_EXECUTOR = new ThreadPoolExecutor(6, 6,
60L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(),
public static synchronized ExecutorService io() {
if (IO_EXECUTOR == null) {
int threads = Math.min(Runtime.getRuntime().availableProcessors() * 4, 64);
IO_EXECUTOR = Executors.newFixedThreadPool(threads,
runnable -> {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setDaemon(true);
return thread;
});
}
return IO_EXECUTOR;
}
private static volatile ExecutorService SINGLE_EXECUTOR;
public static synchronized ExecutorService computation() {
if (SINGLE_EXECUTOR == null)
SINGLE_EXECUTOR = Executors.newSingleThreadExecutor(runnable -> {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setDaemon(true);
return thread;
});
return SINGLE_EXECUTOR;
}
public static Executor javafx() {
return Platform::runLater;
}
@ -91,9 +78,6 @@ public final class Schedulers {
if (IO_EXECUTOR != null)
IO_EXECUTOR.shutdownNow();
if (SINGLE_EXECUTOR != null)
SINGLE_EXECUTOR.shutdownNow();
}
public static Future<?> schedule(Executor executor, Runnable command) {