Klasse ListenerThreadManager

java.lang.Object
java.lang.Thread
eu.hobbydev.bracheus.manager.ListenerThreadManager
Alle implementierten Schnittstellen:
HumanizerTools, Runnable

public class ListenerThreadManager extends Thread implements HumanizerTools
The ListenerThreadManager class is responsible for managing and executing listeners in a separate thread. This class extends the Thread class and continuously checks each registered listener at regular intervals. The listeners perform specific checks and actions as defined by their implementation.

The thread can be stopped gracefully by calling the stopManager method, which halts the thread's execution.

  • Konstruktordetails

    • ListenerThreadManager

      public ListenerThreadManager(SeleniumManager seleniumManager)
      Constructs a new ListenerThreadManager with the specified SeleniumManager. This manager will handle the execution of the listeners.
      Parameter:
      seleniumManager - the SeleniumManager instance that may be used for actions within the listeners.
  • Methodendetails

    • addListener

      public void addListener(Listener listener)
      Adds a listener to the list of listeners. This method is synchronized to ensure thread-safety when adding listeners.
      Parameter:
      listener - the listener to be added to the list.
    • stopManager

      public void stopManager()
      Stops the listener thread by setting the running flag to false and interrupting the thread. This will terminate the execution of the listener checks.
    • run

      public void run()
      Runs the thread that continuously checks each registered listener. It invokes the Listener.runCheckup() method for each listener and waits for a defined period before repeating. If no listeners are registered, the thread will wait for 30 seconds before checking again.
      Angegeben von:
      run in Schnittstelle Runnable
      Setzt außer Kraft:
      run in Klasse Thread
    • getSeleniumManager

      public SeleniumManager getSeleniumManager()
      Returns the SeleniumManager instance associated with this ListenerThreadManager.
      Gibt zurück:
      the SeleniumManager instance used for handling listener.