Class InternalEventManager

java.lang.Object
com.github.eventmanager.InternalEventManager

public final class InternalEventManager extends Object
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 Details

  • Constructor Details

    • InternalEventManager

      public InternalEventManager(LogHandler logHandler)
  • 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

      protected void writeEventToLogFile(String event)
      Logs a message with the specified level and message to the log file.
      Parameters:
      event - the event to log.
    • logFatal

      public void logFatal(String message)
      Log a fatal events to the log file.
      Parameters:
      message - the message to log.
    • logError

      public void logError(String message)
      Log an error event to the log file.
      Parameters:
      message - the message to log.
    • logWarn

      public void logWarn(String message)
      Log a warning event to the log file.
      Parameters:
      message - the message to log.
    • logInfo

      public void logInfo(String message)
      Log an informational event to the log file.
      Parameters:
      message - the message to log.
    • logDebug

      public void logDebug(String message)
      Log a debug event to the log file.
      Parameters:
      message - the message to log.
    • areInfoLogsEnabled

      public boolean areInfoLogsEnabled()
    • initiateThreads

      protected void initiateThreads()
    • processEvent

      protected String processEvent(String event)
    • initiatEventThread

      @Deprecated public Thread 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. Use ManagerBase.initiatEventThread() instead.
      Creates a new Thread to write events to the log file. It will run indefinitely until it is interrupted (either by calling the ManagerBase.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

      protected Thread initiateEventThread()
    • setMetaDataFields

      protected Map<String,String> setMetaDataFields(String level)
      Sets the metadata fields for the event.
      Parameters:
      level - the log level of the event.
      Returns:
      a map containing the metadata fields.
    • logMessage

      protected void logMessage(String level, Object message)
      Logs a message to the destination file.
      Parameters:
      level - the log level of the message.
      message - the object to log.
    • writeEventToQueue

      protected void writeEventToQueue(String event)
      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

      protected void writeEventToProcessingQueue(String event)