From b52283afa3f76520ab449a55f7a3dd7771151477 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 17 Jun 2023 17:13:46 +0200 Subject: [PATCH] Update and hopefully fix the persisting issue Signed-off-by: yoyosource --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 2 ++ .../de/steamwar/bausystem/features/world/RamUsage.java | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 1d1e6362..23293543 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.configplayer.Config; +import de.steamwar.bausystem.features.world.RamUsage; import de.steamwar.bausystem.region.loader.PrototypeLoader; import de.steamwar.bausystem.region.loader.RegionLoader; import de.steamwar.bausystem.region.loader.Updater; @@ -73,6 +74,7 @@ public class BauSystem extends JavaPlugin implements Listener { new Updater(RegionLoader.file, RegionLoader::load); LinkageUtils.link(); + RamUsage.init(); // This could disable any watchdog stuff. We need to investigate if this is a problem. /* diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/RamUsage.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/RamUsage.java index a4451fda..6cf1600a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/RamUsage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/RamUsage.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.world; import lombok.experimental.UtilityClass; import java.io.*; +import java.util.concurrent.locks.LockSupport; @UtilityClass public class RamUsage { @@ -48,11 +49,8 @@ public class RamUsage { usage = _getUsage(); load = _getLoad(); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } + Thread.yield(); + LockSupport.parkNanos(1000000000L); } }); thread.setDaemon(true);