Fixes gc hang
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package io.akarin.server.mixin.bootstrap;
|
||||
|
||||
import org.spigotmc.RestartCommand;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
||||
import io.akarin.api.internal.Akari;
|
||||
import io.akarin.server.core.AkarinGlobalConfig;
|
||||
|
||||
@Mixin(value = RestartCommand.class, remap = false)
|
||||
public abstract class MixinRestartCommand {
|
||||
@Inject(method = "restart()V", at = @At("HEAD"))
|
||||
public static void beforeRestart() {
|
||||
if (AkarinGlobalConfig.noResponseDoGC) {
|
||||
Akari.logger.warn("Attempting to garbage collect, may takes a few seconds");
|
||||
System.runFinalization();
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import io.akarin.server.core.AkarinGlobalConfig;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
@Mixin(value = WatchdogThread.class, remap = false)
|
||||
@@ -75,11 +74,7 @@ public abstract class Watchcat extends Thread {
|
||||
}
|
||||
log.log(Level.SEVERE, "------------------------------");
|
||||
|
||||
if (AkarinGlobalConfig.noResponseDoGC) {
|
||||
log.log(Level.SEVERE, "Attempting to garbage collect, may takes a few seconds");
|
||||
System.gc();
|
||||
}
|
||||
if (restart) RestartCommand.restart();
|
||||
if (restart) RestartCommand.restart(); // GC Inlined
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"bootstrap.MixinMetrics",
|
||||
"bootstrap.ParallelRegistry",
|
||||
"bootstrap.MetricsBootstrap",
|
||||
"bootstrap.MixinRestartCommand",
|
||||
|
||||
"core.MixinMCUtil",
|
||||
"core.MixinCommandBan",
|
||||
|
||||
Submodule work/Paper updated: f840373345...6ea9d3a5c2
Reference in New Issue
Block a user