java.lang.Object
com.github.eventmanager.InternalEventManager
The InternalEventManager class is responsible for managing internal events of the EventManager library. It provides
a reliable way to identify and troubleshoot possibly issues within the library.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BlockingQueue<String>
protected Thread
protected LogHandler
protected final BlockingQueue<String>
protected Thread
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected Thread
protected void
Deprecated.This method is deprecated and will be removed in a future release, as it was not intended to be used by external classes...void
Log a debug event to the log file.void
Log an error event to the log file.void
Log a fatal events to the log file.void
Log an informational event to the log file.protected void
logMessage
(String level, Object message) Logs a message to the destination file.void
Log a warning event to the log file.protected String
processEvent
(String event) setMetaDataFields
(String level) Sets the metadata fields for the event.void
Stops the event thread by interrupting it and waiting for it to finish.protected void
writeEventToLogFile
(String event) Logs a message with the specified level and message to the log file.protected void
protected void
writeEventToQueue
(String event) Writes the given event to the event queue.
-
Field Details
-
logHandler
-
eventThread
-
processingThread
-
processors
-
eventQueue
-
processingQueue
-
-
Constructor Details
-
InternalEventManager
-
-
Method Details
-
stopEventThread
public void stopEventThread()Stops the event thread by interrupting it and waiting for it to finish. This method should be called before shutting down the application to ensure that all events are written to the log file. -
writeEventToLogFile
Logs a message with the specified level and message to the log file.- Parameters:
event
- the event to log.
-
logFatal
Log a fatal events to the log file.- Parameters:
message
- the message to log.
-
logError
Log an error event to the log file.- Parameters:
message
- the message to log.
-
logWarn
Log a warning event to the log file.- Parameters:
message
- the message to log.
-
logInfo
Log an informational event to the log file.- Parameters:
message
- the message to log.
-
logDebug
Log a debug event to the log file.- Parameters:
message
- the message to log.
-
areInfoLogsEnabled
public boolean areInfoLogsEnabled() -
initiateThreads
protected void initiateThreads() -
processEvent
-
initiatEventThread
Deprecated.This method is deprecated and will be removed in a future release, as it was not intended to be used by external classes... there was also a typo. UseManagerBase.initiatEventThread()
instead.Creates a new Thread to write events to the log file. It will run indefinitely until it is interrupted (either by calling theManagerBase.stopEventThread()
method or by the JVM shutting down). The thread will write events to the log file if the queue is not empty and internal events are enabled. -
initiateEventThread
-
setMetaDataFields
Sets the metadata fields for the event.- Parameters:
level
- the log level of the event.- Returns:
- a map containing the metadata fields.
-
logMessage
Logs a message to the destination file.- Parameters:
level
- the log level of the message.message
- the object to log.
-
writeEventToQueue
Writes the given event to the event queue. This method is thread-safe and can be called from multiple threads.- Parameters:
event
- the event to write to the queue.
-
writeEventToProcessingQueue
-