mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-27 18:01:33 +01:00
Switch the default asynchronous CallContext to ASYNCHRONOUS_TASK.
This will preserve the order of debug messages sent from multiple threads. As a side effect, this might be better for performance, given that on constant input the logging task will stay registered, so there is little overhead and the file-io is taken off the asynchronous packet and chat handler threads.Hopefully the thread switching is less expensive than the gain by not delaying chat/packet threads, in case of servers with few cores. We might adapt the used policy later, based on cores and/or config.
This commit is contained in:
parent
b179dba908
commit
4d59f67d34
@ -26,7 +26,7 @@ public class LogOptions {
|
||||
ASYNCHRONOUS_DIRECT,
|
||||
/** Always schedule to execute within a (more or less) dedicated asynchronous task. */
|
||||
ASYNCHRONOUS_TASK,
|
||||
/** Ensure it's logged asynchronously. */
|
||||
/** Only log if it is not the primary thread. */
|
||||
ASYNCHRONOUS_ONLY,
|
||||
|
||||
// CUSTOM_THREAD_DIRECT|TASK // Needs a variable (Thread, methods to sync into a specific thread would have to be registered in LogManager).
|
||||
|
@ -102,7 +102,7 @@ public class BukkitLogManager extends AbstractLogManager implements INotifyReloa
|
||||
// TODO: Might attempt to detect if a thread-safe logging framework is in use ("default" instead of false/true).
|
||||
boolean bukkitLoggerAsynchronous = config.getBoolean(ConfPaths.LOGGING_BACKEND_CONSOLE_ASYNCHRONOUS);
|
||||
// TODO: Do keep considering: AYNCHRONOUS_DIRECT -> ASYNCHRONOUS_TASK (not to delay async. event handling).
|
||||
CallContext defaultAsynchronousContext = CallContext.ASYNCHRONOUS_DIRECT; // Plugin runtime + asynchronous.
|
||||
CallContext defaultAsynchronousContext = CallContext.ASYNCHRONOUS_TASK; // Plugin runtime + asynchronous.
|
||||
|
||||
// Server logger.
|
||||
tempID = registerStringLogger(Bukkit.getLogger(), new LogOptions(Streams.SERVER_LOGGER.name, bukkitLoggerAsynchronous ? defaultAsynchronousContext : CallContext.PRIMARY_THREAD_TASK));
|
||||
|
Loading…
Reference in New Issue
Block a user