Class RoundRobinListenerNotifier

  • All Implemented Interfaces:
    ListenerNotifier, Configurable, java.lang.Runnable

    public class RoundRobinListenerNotifier
    extends DefaultConfigurable
    implements ListenerNotifier, java.lang.Runnable
    Use round-robin queues to notify listeners. This attempts to prevent any one product source+type from blocking processing of notifications from other product source+type.
    • Constructor Detail

      • RoundRobinListenerNotifier

        public RoundRobinListenerNotifier​(DefaultNotificationReceiver receiver)
        Create new RoundRobinListenerNotifier.
        Parameters:
        receiver - the receiver using this notifier.
    • Method Detail

      • startup

        public void startup()
                     throws java.lang.Exception
        Start the status/requeue thread.
        Specified by:
        startup in interface Configurable
        Overrides:
        startup in class DefaultConfigurable
        Throws:
        java.lang.Exception - if exceptions occur while starting.
      • addNotificationListener

        public void addNotificationListener​(NotificationListener listener)
                                     throws java.lang.Exception
        Add a notification listener.
        Specified by:
        addNotificationListener in interface ListenerNotifier
        Parameters:
        listener - NotificationListener
        Throws:
        java.lang.Exception - if error occurs
      • removeNotificationListener

        public void removeNotificationListener​(NotificationListener listener)
                                        throws java.lang.Exception
        Remove a notification listener.
        Specified by:
        removeNotificationListener in interface ListenerNotifier
        Parameters:
        listener - NotificationListener
        Throws:
        java.lang.Exception - if error occurs
      • notifyListeners

        public void notifyListeners​(NotificationEvent event)
                             throws java.lang.Exception
        Notify listeners.
        Specified by:
        notifyListeners in interface ListenerNotifier
        Parameters:
        event - NotificationEvent
        Throws:
        java.lang.Exception - if error occurs
      • notifyListeners

        protected void notifyListeners​(NotificationEvent event,
                                       java.util.Collection<ListenerNotifierThread> toNotify)
                                throws java.lang.Exception
        Notify a specific list of listeners. Used during renotification to only notify listeners that have an index.
        Parameters:
        event - notification.
        toNotify - list of listeners to notify.
        Throws:
        java.lang.Exception - if error occurs
      • run

        public void run()
        Run status/requeue tasks.
        Specified by:
        run in interface java.lang.Runnable
      • requeue

        protected void requeue()
                        throws java.lang.Exception
        Requeue existing notifications at startup.
        Throws:
        java.lang.Exception - if error occurs