Rename setting 'optimizeSubsystemInitialization'

This commit is contained in:
JeremyStar™ 2024-09-21 17:24:27 +02:00
parent a00fdea6f5
commit 3d3f21e217
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 30 additions and 24 deletions

View file

@ -210,7 +210,7 @@ public final class Engine extends SubsystemClass {
state = EngineState.STARTUP;
// Perform automatic subsystem initialization
if (EngineConfiguration.getInstance().isOptimizeSubsystemInitialization()) {
if (EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization()) {
collectSubsystems(); // Collect subsystems
// Initialize subsystems

View file

@ -81,6 +81,7 @@ public final class EngineConfiguration extends Configuration {
*/
private final @NotNull String group = "sosengine.base.";
/**
* If enabled, allows for unintentional behaviour
* and excess logging. Unless you want to debug or work
@ -124,6 +125,28 @@ public final class EngineConfiguration extends Configuration {
*/
private boolean debugShortcodeConverter;
/**
* If enabled, will try to automatically initialize every
* subsystem found though reflection.
* <p>
* 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
* won't be performed, be careful when initializing subsystems manually.
*
* @see Engine
* @since v1-alpha2
* -- GETTER --
* Gets the value for {@link #initialPerformSubsystemInitialization}.
*
* @return variable value
* @see #initialPerformSubsystemInitialization
* @since v1-alpha2
*/
private boolean initialPerformSubsystemInitialization;
/**
* If enabled, will force-disable reflective classpath scanning.
*
@ -153,6 +176,7 @@ public final class EngineConfiguration extends Configuration {
*/
private Set<@NotNull String> initialIncludeSubsystemClasses;
/**
* If enabled, invalid shortcodes will be logged by the {@link ShortcodeParser}.
* The message will be printed as a {@link LogLevel#SILENT_WARNING}.
@ -169,6 +193,7 @@ public final class EngineConfiguration extends Configuration {
*/
private boolean errorShortcodeConverter;
/**
* If enabled, will makes the {@link Logger} work asynchronous,
* in a separate platform thread. Don't disable unless you want
@ -202,26 +227,6 @@ public final class EngineConfiguration extends Configuration {
*/
private boolean optimizeEvents;
/**
* If enabled, will try to automatically initialize every
* subsystem found though reflection.
* <p>
* 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
* won't be performed, be careful when initializing subsystems manually.
*
* @see Engine
* @since v1-alpha2
* -- GETTER --
* Gets the value for {@link #optimizeSubsystemInitialization}.
*
* @return variable value
* @see #optimizeSubsystemInitialization
* @since v1-alpha2
*/
private boolean optimizeSubsystemInitialization;
/**
* Contains which logger levels are allowed
@ -327,6 +332,7 @@ public final class EngineConfiguration extends Configuration {
*/
private boolean loggerImmediateShutdown;
/**
* Will truncate the path of types when using
* their {@code toString} method.
@ -379,6 +385,7 @@ public final class EngineConfiguration extends Configuration {
case "debugEvents" -> debugEvents = parser.getBoolean(group + property);
case "debugShortcodeConverter" -> debugShortcodeConverter = parser.getBoolean(group + property);
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization = parser.getBoolean(group + property);
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning = parser.getBoolean(group + property);
case "initialIncludeSubsystemClasses" -> {
initialIncludeSubsystemClasses = new HashSet<>();
@ -395,7 +402,6 @@ public final class EngineConfiguration extends Configuration {
LoggingThread.startThread();
}
case "optimizeEvents" -> optimizeEvents = parser.getBoolean(group + property);
case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization = parser.getBoolean(group + property);
case "loggerLevel" -> {
try {
@ -432,6 +438,7 @@ public final class EngineConfiguration extends Configuration {
debugEvents = false;
debugShortcodeConverter = false;
initialPerformSubsystemInitialization = true;
initialForceDisableClasspathScanning = false;
initialIncludeSubsystemClasses = new HashSet<>();
@ -439,7 +446,6 @@ public final class EngineConfiguration extends Configuration {
optimizeLogging = true;
optimizeEvents = true;
optimizeSubsystemInitialization = true;
loggerLevel = LogLevel.INFORMATIONAL;
loggerTemplate = "%log_color_primary%[%time_hour%:%time_minute%:%time_second%] [%log_level% %log_path%%log_metadata%] %log_message_prefix%%log_color_primary%%log_color_secondary%%log_message%<reset>";
@ -459,6 +465,7 @@ public final class EngineConfiguration extends Configuration {
case "debugEvents" -> debugEvents;
case "debugShortcodeConverter" -> debugShortcodeConverter;
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization;
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses;
@ -466,7 +473,6 @@ public final class EngineConfiguration extends Configuration {
case "optimizeLogging" -> optimizeLogging;
case "optimizeEvents" -> optimizeEvents;
case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization;
case "loggerLevel" -> loggerLevel;
case "loggerTemplate" -> loggerTemplate;