3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Don't expose executor and future map

Dieser Commit ist enthalten in:
KennyTV 2020-03-23 12:22:34 +01:00
Ursprung 248fd92f6e
Commit 563c5f830d

Datei anzeigen

@ -127,8 +127,7 @@ public class ProtocolRegistry {
if (protocol.hasMappingDataToLoad()) {
if (mappingLoaderExecutor != null) {
// Submit mapping data loading
CompletableFuture<Void> future = CompletableFuture.runAsync(protocol::loadMappingData, mappingLoaderExecutor);
mappingLoaderFutures.put(protocol.getClass(), future);
addMappingLoaderFuture(protocol.getClass(), protocol::loadMappingData);
} else {
// Late protocol adding - just do it on the current thread
protocol.loadMappingData();
@ -330,15 +329,12 @@ public class ProtocolRegistry {
}
}
public static void addMappingLoaderFuture(Class<? extends Protocol> protocolClass, Runnable runnable) {
CompletableFuture<Void> future = CompletableFuture.runAsync(runnable, mappingLoaderExecutor);
mappingLoaderFutures.put(protocolClass, future);
}
public static CompletableFuture<Void> getMappingLoaderFuture(Class<? extends Protocol> protocolClass) {
return mappingLoaderFutures.get(protocolClass);
}
public static Map<Class<? extends Protocol>, CompletableFuture<Void>> getMappingLoaderFutures() {
return mappingLoaderFutures;
}
public static ThreadPoolExecutor getMappingLoaderExecutor() {
return mappingLoaderExecutor;
}
}