mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-03-07 17:36:52 +08:00
alt: rename natives directory
This commit is contained in:
parent
fb4a499fe9
commit
1ca4045a2f
@ -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());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user