3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Uncap mapping loader executor pool, less logging

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-02-20 17:30:56 +01:00
Ursprung 1157029f23
Commit bf4e4d771f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -68,7 +68,9 @@ public class MappingDataBase implements MappingData {
@Override
public void load() {
getLogger().info("Loading " + oldVersion + " -> " + newVersion + " mappings...");
if (Via.getManager().isDebug()) {
getLogger().info("Loading " + oldVersion + " -> " + newVersion + " mappings...");
}
JsonObject diffmapping = hasDiffFile ? loadDiffFile() : null;
JsonObject oldMappings = MappingDataLoader.loadData("mapping-" + oldVersion + ".json", true);
JsonObject newMappings = MappingDataLoader.loadData("mapping-" + newVersion + ".json", true);

Datei anzeigen

@ -87,9 +87,11 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
protocolSupport = Bukkit.getPluginManager().getPlugin("ProtocolSupport") != null;
lateBind = !((BukkitViaInjector) Via.getManager().getInjector()).isBinded();
getLogger().info("ViaVersion " + getDescription().getVersion() + " is now loaded" + (lateBind ? ", waiting for boot. (late-bind)" : ", injecting!"));
if (!lateBind) {
getLogger().info("ViaVersion " + getDescription().getVersion() + " is now loaded. Registering protocol transformers and injecting...");
((ViaManagerImpl) Via.getManager()).init();
} else {
getLogger().info("ViaVersion " + getDescription().getVersion() + " is now loaded. Waiting for boot (late-bind).");
}
}
@ -105,6 +107,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
@Override
public void onEnable() {
if (lateBind) {
getLogger().info("Registering protocol transformers and injecting...");
((ViaManagerImpl) Via.getManager()).init();
}

Datei anzeigen

@ -126,7 +126,7 @@ public class ProtocolManagerImpl implements ProtocolManager {
public ProtocolManagerImpl() {
ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Via-Mappingloader-%d").build();
mappingLoaderExecutor = new ThreadPoolExecutor(5, 16, 45L, TimeUnit.SECONDS, new SynchronousQueue<>(), threadFactory);
mappingLoaderExecutor = new ThreadPoolExecutor(12, Integer.MAX_VALUE, 30L, TimeUnit.SECONDS, new SynchronousQueue<>(), threadFactory);
mappingLoaderExecutor.allowCoreThreadTimeOut(true);
}
@ -434,7 +434,9 @@ public class ProtocolManagerImpl implements ProtocolManager {
public boolean checkForMappingCompletion() {
mappingLoaderLock.readLock().lock();
try {
if (mappingsLoaded) return false;
if (mappingsLoaded) {
return false;
}
for (CompletableFuture<Void> future : mappingLoaderFutures.values()) {
// Return if any future hasn't completed yet