Move leak detector to standalone bootstrap class

This commit is contained in:
Redned 2021-07-18 17:44:08 -05:00 committed by RednedEpic
parent 39324ce95d
commit 1a0ac26398
2 changed files with 5 additions and 5 deletions

View file

@ -30,6 +30,7 @@ import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.AnnotatedField;
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
import io.netty.util.ResourceLeakDetector;
import lombok.Getter;
import net.minecrell.terminalconsole.TerminalConsoleAppender;
import org.apache.logging.log4j.Level;
@ -80,6 +81,10 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
private static final Map<String, String> argsConfigKeys = new HashMap<>();
public static void main(String[] args) {
if (System.getProperty("io.netty.leakDetection.level") == null) {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance
}
GeyserStandaloneBootstrap bootstrap = new GeyserStandaloneBootstrap();
// Set defaults
boolean useGuiOpts = bootstrap.useGui;

View file

@ -34,7 +34,6 @@ import com.nukkitx.network.util.EventLoops;
import com.nukkitx.protocol.bedrock.BedrockServer;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.kqueue.KQueue;
import io.netty.util.ResourceLeakDetector;
import lombok.Getter;
import lombok.Setter;
import org.geysermc.common.PlatformType;
@ -126,10 +125,6 @@ public class GeyserConnector {
private Metrics metrics;
private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) {
if (platformType == PlatformType.STANDALONE && System.getProperty("io.netty.leakDetection.level") == null) {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance
}
long startupTime = System.currentTimeMillis();
instance = this;