From 445b1fb4f24fdf282be17b6d61ec08221dd6e47b Mon Sep 17 00:00:00 2001 From: Yinzi Xie Date: Mon, 23 Sep 2024 11:09:36 +0000 Subject: [PATCH 1/3] fix: high CPU usage in Windows --- .../com/tle/core/equella/runner/EQUELLAServer.java | 3 ++- .../src/com/tle/upgrademanager/Main.java | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/Server/equellaserver/src/com/tle/core/equella/runner/EQUELLAServer.java b/Source/Server/equellaserver/src/com/tle/core/equella/runner/EQUELLAServer.java index 0d86db397e..7ee6e33a2b 100644 --- a/Source/Server/equellaserver/src/com/tle/core/equella/runner/EQUELLAServer.java +++ b/Source/Server/equellaserver/src/com/tle/core/equella/runner/EQUELLAServer.java @@ -75,11 +75,12 @@ public void destroy() { * Method to be called when the OEQ is started as a Windows service. According to the Procrun * documentation, this method should not return until the stop method has been called in JVM mode. */ - public static void start(String[] args) { + public static void start(String[] args) throws InterruptedException { System.out.println("Starting EQUELLA Server..."); main(new String[0]); while (!stopped) { // DO not return until `stop` is called. + Thread.sleep(1000); } } diff --git a/Source/Tools/UpgradeManager/src/com/tle/upgrademanager/Main.java b/Source/Tools/UpgradeManager/src/com/tle/upgrademanager/Main.java index bfcf2e9070..464e84b2dc 100644 --- a/Source/Tools/UpgradeManager/src/com/tle/upgrademanager/Main.java +++ b/Source/Tools/UpgradeManager/src/com/tle/upgrademanager/Main.java @@ -56,6 +56,8 @@ */ public class Main { private static final Log LOGGER = LogFactory.getLog(Main.class); + // Flag to stop the manager. + private static volatile boolean stop; public static final String EQUELLA_INSTALL_DIRECTORY_KEY = "equella.install.directory"; //$NON-NLS-1$ @@ -65,13 +67,20 @@ public class Main { private static HttpServer server; + /** + * Method to be called when the Manager is started. According to the Procrun documentation, this + * method should not return until the stop method has been called in JVM mode. + */ public static void main(String[] args) throws Exception { if (Check.isEmpty(args) || Check.isEmpty(args[0]) || args[0].equals("start")) // $NON-NLS-1$ { Main m = new Main(); m.startServer(); - } else if (args[0].equals("stop")) // $NON-NLS-1$ - { + while (!stop) { + Thread.sleep(1000); + } + } else if (args[0].equals("stop")) { + stop = true; if (server != null) { server.stop(4); } From ade72b9a1a4bdd7edf3fd0f8ef8a63043700b29d Mon Sep 17 00:00:00 2001 From: edalex-yinzi Date: Thu, 26 Sep 2024 15:35:20 +1000 Subject: [PATCH 2/3] build: bump version to 2024.1.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d85e1de925..c05566c1dc 100644 --- a/build.sbt +++ b/build.sbt @@ -90,7 +90,7 @@ name := "Equella" (ThisBuild / equellaMajor) := 2024 (ThisBuild / equellaMinor) := 1 -(ThisBuild / equellaPatch) := 0 +(ThisBuild / equellaPatch) := 1 (ThisBuild / equellaStream) := "Stable" (ThisBuild / equellaBuild) := buildConfig.value.getString("build.buildname") (ThisBuild / buildTimestamp) := Instant.now().getEpochSecond From 114adb19dbd1156227b7da634913ff9029f822f6 Mon Sep 17 00:00:00 2001 From: edalex-yinzi Date: Fri, 27 Sep 2024 09:31:56 +1000 Subject: [PATCH 3/3] chore: update checkstyle thresholdNumber to 448 --- checkstyle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkstyle.sh b/checkstyle.sh index 72563714de..361d37f948 100755 --- a/checkstyle.sh +++ b/checkstyle.sh @@ -3,7 +3,7 @@ ## Run Checkstyle for all the Java files in the project. ## If the number of errors is either greater or smaller than the threshold, output an error message and exit with status 1. -thresholdNumber=449 +thresholdNumber=448 result=$(checkstyle -c checkstyle-config.xml -o checkstyle-report.txt . 2>&1) echo $result