Class ListenerNotifierThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class ListenerNotifierThread
    extends java.lang.Object
    implements java.lang.Runnable
    Thread that delivers notifications to a listener. Uses interrupt to stop thread, so listeners should be careful when also using interrupts.
    • Constructor Detail

      • ListenerNotifierThread

        public ListenerNotifierThread​(NotificationListener listener)
        Create a new listener notifier thread.
        Parameters:
        listener - listener that receives notifications.
    • Method Detail

      • start

        public void start()
        Start processing notifications in the queue.
      • stop

        public void stop()
        Stop processing notifications in the queue.
      • run

        public void run()
        Process notifications in the queue.
        Specified by:
        run in interface java.lang.Runnable
      • notify

        public void notify​(NotificationEvent event)
        Add a notification to the queue. Checks if notification is "accept"able before queueing.
        Parameters:
        event - notification to add.
      • getErrorQueue

        public java.util.concurrent.LinkedBlockingQueue<ListenerNotification> getErrorQueue()
        Returns:
        the error queue.
      • requeueErrors

        public void requeueErrors()
        Move any failed notifications that are ready to be retried from the error queue into the queue.