Uncap mapping loader executor pool, less logging

This commit is contained in:
Nassim Jahnke 2023-02-20 17:30:56 +01:00
parent 1157029f23
commit bf4e4d771f
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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();
}

View File

@ -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