From 062b68a93b90311e085ceb4ccd186c6358075fa6 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 23 Jul 2024 19:51:00 +0200 Subject: [PATCH] Update setting order --- .../sosengine/base/EngineConfiguration.java | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java b/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java index 3613be1..e43eaf2 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java +++ b/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java @@ -143,6 +143,59 @@ public final class EngineConfiguration implements SubsystemConfiguration { */ private boolean errorShortcodeConverter; + /** + * If enabled, will makes the {@link Logger} work asynchronous, in a separate platform thread. + * Don't disable unless you want your application to run extremely slowly. + * + * @see EngineConfiguration#loggerPollingSpeed + * @see Thread + * @since v1-alpha0 + * + * -- GETTER -- + * Gets the value for {@link #optimizeLogging}. + * + * @return variable value + * @see EngineConfiguration#optimizeLogging + * @since v1-alpha0 + */ + private boolean optimizeLogging; + + /** + * If enabled, will make all events asynchronous, in separate virtual threads. + * Don't disable unless you want your application to run slower. + * + * @see VirtualThread + * @since v1-alpha0 + * + * -- GETTER -- + * Gets the value for {@link #optimizeEvents}. + * + * @return variable value + * @see EngineConfiguration#optimizeEvents + * @since v1-alpha0 + */ + private boolean optimizeEvents; + + /** + * If enabled, will try to automatically initialize every subsystem found though reflection. + *

+ * This however may fail in certain situation, where manual subsystem initialization may be required. + * For this reason, this can be turned off before the engine initializes. + * Please note though that dependency resolution between subsystems will not be done, be careful when + * initializing subsystems manually. + * + * @see Engine + * @since v1-alpha2 + * + * -- GETTER -- + * Gets the value for {@link #optimizeSubsystemInitialization}. + * + * @return variable value + * @see EngineConfiguration#optimizeSubsystemInitialization + * @since v1-alpha2 + */ + private boolean optimizeSubsystemInitialization; + /** * Determines which logger levels are allowed by setting the minimum logger level. * @@ -220,59 +273,6 @@ public final class EngineConfiguration implements SubsystemConfiguration { */ private int loggerPollingSpeed; - /** - * If enabled, will makes the {@link Logger} work asynchronous, in a separate platform thread. - * Don't disable unless you want your application to run extremely slowly. - * - * @see EngineConfiguration#loggerPollingSpeed - * @see Thread - * @since v1-alpha0 - * - * -- GETTER -- - * Gets the value for {@link #optimizeLogging}. - * - * @return variable value - * @see EngineConfiguration#optimizeLogging - * @since v1-alpha0 - */ - private boolean optimizeLogging; - - /** - * If enabled, will make all events asynchronous, in separate virtual threads. - * Don't disable unless you want your application to run slower. - * - * @see VirtualThread - * @since v1-alpha0 - * - * -- GETTER -- - * Gets the value for {@link #optimizeEvents}. - * - * @return variable value - * @see EngineConfiguration#optimizeEvents - * @since v1-alpha0 - */ - private boolean optimizeEvents; - - /** - * If enabled, will try to automatically initialize every subsystem found though reflection. - *

- * This however may fail in certain situation, where manual subsystem initialization may be required. - * For this reason, this can be turned off before the engine initializes. - * Please note though that dependency resolution between subsystems will not be done, be careful when - * initializing subsystems manually. - * - * @see Engine - * @since v1-alpha2 - * - * -- GETTER -- - * Gets the value for {@link #optimizeSubsystemInitialization}. - * - * @return variable value - * @see EngineConfiguration#optimizeSubsystemInitialization - * @since v1-alpha2 - */ - private boolean optimizeSubsystemInitialization; - /** * Constructs this class. * @@ -313,6 +313,10 @@ public final class EngineConfiguration implements SubsystemConfiguration { case "errorShortcodeConverter" -> errorShortcodeConverter = parser.getBoolean(group + property); + case "optimizeLogging" -> optimizeLogging = parser.getBoolean(group + property); + case "optimizeEvents" -> optimizeEvents = parser.getBoolean(group + property); + case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization = parser.getBoolean(group + property); + case "loggerLevel" -> { try { loggerLevel = LogLevel.valueOf(parser.getString(group + property).toUpperCase()); @@ -324,10 +328,6 @@ public final class EngineConfiguration implements SubsystemConfiguration { case "loggerImmediateShutdown" -> loggerImmediateShutdown = parser.getBoolean(group + property); case "loggerForceStandardOutput" -> loggerForceStandardOutput = parser.getBoolean(group + property); case "loggerPollingSpeed" -> loggerPollingSpeed = parser.getInteger(group + property, true); - - case "optimizeLogging" -> optimizeLogging = parser.getBoolean(group + property); - case "optimizeEvents" -> optimizeEvents = parser.getBoolean(group + property); - case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization = parser.getBoolean(group + property); } } catch (NullPointerException ignored) {} } @@ -352,15 +352,15 @@ public final class EngineConfiguration implements SubsystemConfiguration { errorShortcodeConverter = true; + optimizeLogging = true; + optimizeEvents = true; + optimizeSubsystemInitialization = true; + loggerLevel = LogLevel.INFORMATIONAL; loggerTemplate = "%log_color_primary%[%time_hour%:%time_minute%:%time_second%] [%log_level% %log_path%%log_info%] %log_color_secondary%%log_message%"; loggerImmediateShutdown = false; loggerForceStandardOutput = false; loggerPollingSpeed = 5; - - optimizeLogging = true; - optimizeEvents = true; - optimizeSubsystemInitialization = true; } /** {@inheritDoc} */ @@ -373,15 +373,15 @@ public final class EngineConfiguration implements SubsystemConfiguration { case "errorShortcodeConverter" -> { return errorShortcodeConverter; } + case "optimizeLogging" -> { return optimizeLogging; } + case "optimizeEvents" -> { return optimizeEvents; } + case "optimizeSubsystemInitialization" -> { return optimizeSubsystemInitialization; } + case "loggerLevel" -> { return loggerLevel; } case "loggerTemplate" -> { return loggerTemplate; } case "loggerImmediateShutdown" -> { return loggerImmediateShutdown; } case "loggerForceStandardOutput" -> { return loggerForceStandardOutput; } case "loggerPollingSpeed" -> { return loggerPollingSpeed; } - - case "optimizeLogging" -> { return optimizeLogging; } - case "optimizeEvents" -> { return optimizeEvents; } - case "optimizeSubsystemInitialization" -> { return optimizeSubsystemInitialization; } default -> { return null; } } }