Wait monitoring should always be enabled

This commit is contained in:
TheMode 2021-04-21 11:37:53 +02:00
parent 224a1f57b4
commit 72002a3d75
2 changed files with 2 additions and 19 deletions

View File

@ -136,7 +136,6 @@ public final class MinecraftServer {
private static int compressionThreshold = 256; private static int compressionThreshold = 256;
private static boolean packetCaching = true; private static boolean packetCaching = true;
private static boolean groupedPacket = true; private static boolean groupedPacket = true;
private static boolean waitMonitoring = true;
private static ResponseDataConsumer responseDataConsumer; private static ResponseDataConsumer responseDataConsumer;
private static String brandName = "Minestom"; private static String brandName = "Minestom";
private static Difficulty difficulty = Difficulty.NORMAL; private static Difficulty difficulty = Difficulty.NORMAL;
@ -614,14 +613,6 @@ public final class MinecraftServer {
MinecraftServer.groupedPacket = groupedPacket; MinecraftServer.groupedPacket = groupedPacket;
} }
public static boolean hasWaitMonitoring() {
return waitMonitoring;
}
public static void setWaitMonitoring(boolean waitMonitoring) {
MinecraftServer.waitMonitoring = waitMonitoring;
}
/** /**
* Gets the consumer executed to show server-list data. * Gets the consumer executed to show server-list data.
* *

View File

@ -1,6 +1,5 @@
package net.minestom.server.lock; package net.minestom.server.lock;
import net.minestom.server.MinecraftServer;
import net.minestom.server.thread.BatchThread; import net.minestom.server.thread.BatchThread;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -90,11 +89,7 @@ public final class Acquisition {
protected static ReentrantLock acquireEnter(Thread currentThread, BatchThread elementThread) { protected static ReentrantLock acquireEnter(Thread currentThread, BatchThread elementThread) {
// Monitoring // Monitoring
final boolean monitoring = MinecraftServer.hasWaitMonitoring(); long time = System.nanoTime();
long time = 0;
if (monitoring) {
time = System.nanoTime();
}
ReentrantLock currentLock; ReentrantLock currentLock;
{ {
@ -118,10 +113,7 @@ public final class Acquisition {
} }
// Monitoring // Monitoring
if (monitoring) { WAIT_COUNTER_NANO.addAndGet(System.nanoTime() - time);
time = System.nanoTime() - time;
WAIT_COUNTER_NANO.addAndGet(time);
}
return !acquired ? lock : null; return !acquired ? lock : null;
} }