Upstream Paper w/ Removes termination config

This commit is contained in:
Sotr
2018-06-11 14:33:03 +08:00
parent a17a194c6a
commit c43b8592c9
3 changed files with 5 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import io.akarin.api.Akari; import io.akarin.api.Akari;
@SuppressWarnings("unused")
public class AkarinGlobalConfig { public class AkarinGlobalConfig {
private static File CONFIG_FILE; private static File CONFIG_FILE;
@@ -153,11 +154,6 @@ public class AkarinGlobalConfig {
legacyVersioningCompat = getBoolean("alternative.legacy-versioning-compat", false); legacyVersioningCompat = getBoolean("alternative.legacy-versioning-compat", false);
} }
public static int registryTerminationSeconds;
private static void registryTerminationSeconds() {
registryTerminationSeconds = getSeconds(getString("bootstrap.parallel-registry-termination", "9s"));
}
public static int playersPerIOThread; public static int playersPerIOThread;
private static void playersPerIOThread() { private static void playersPerIOThread() {
playersPerIOThread = getInt("core.players-per-chunk-io-thread", 50); playersPerIOThread = getInt("core.players-per-chunk-io-thread", 50);

View File

@@ -11,7 +11,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import io.akarin.api.Akari; import io.akarin.api.Akari;
import io.akarin.server.core.AkarinGlobalConfig;
import net.minecraft.server.BiomeBase; import net.minecraft.server.BiomeBase;
import net.minecraft.server.Block; import net.minecraft.server.Block;
import net.minecraft.server.BlockFire; import net.minecraft.server.BlockFire;
@@ -40,8 +39,6 @@ public class ParallelRegistry {
*/ */
private static final ExecutorService STAGE_STANDALONE = Executors.newFixedThreadPool(3, Akari.STAGE_FACTORY); private static final ExecutorService STAGE_STANDALONE = Executors.newFixedThreadPool(3, Akari.STAGE_FACTORY);
private static final int TERMINATION_IN_SEC = AkarinGlobalConfig.registryTerminationSeconds;
// We should keep the original order in codes thought orderless in runtime // We should keep the original order in codes thought orderless in runtime
@Redirect(method = "c()V", at = @At( @Redirect(method = "c()V", at = @At(
value = "INVOKE", value = "INVOKE",
@@ -131,11 +128,11 @@ public class ParallelRegistry {
// Shutdown BLOCK and STANDALONE stage // Shutdown BLOCK and STANDALONE stage
STAGE_STANDALONE.shutdown(); STAGE_STANDALONE.shutdown();
STAGE_BLOCK.shutdown(); STAGE_BLOCK.shutdown();
STAGE_BLOCK.awaitTermination(TERMINATION_IN_SEC, TimeUnit.SECONDS); STAGE_BLOCK.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
STAGE_BLOCK_BASE.shutdown(); // This must after STAGE_BLOCK terminated STAGE_BLOCK_BASE.shutdown(); // This must after STAGE_BLOCK terminated
STAGE_BLOCK_BASE.awaitTermination(TERMINATION_IN_SEC, TimeUnit.SECONDS); STAGE_BLOCK_BASE.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
STAGE_STANDALONE.awaitTermination(TERMINATION_IN_SEC, TimeUnit.SECONDS); // Behind the shutdown of BLOCK_BASE should faster STAGE_STANDALONE.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); // Behind the shutdown of BLOCK_BASE should faster
} }
} }