Package gov.usgs.earthquake.distribution
Class FutureListenerNotifier
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.distribution.ExecutorListenerNotifier
gov.usgs.earthquake.distribution.FutureListenerNotifier
- All Implemented Interfaces:
ListenerNotifier
,Configurable
FutureListenerNotifier is similar to ExecutorListenerNotifier, but uses
Futures with an ExecutorService to implement timeouts instead of Timers.
backgroundService is an unbounded executor, but will execute only as many
threads are allowed by listener executors since listener executors submit
tasks to the backgroundService and wait on the future.
This ends up being more efficient because the threads where jobs execute are
cached, instead of a new Timer thread created for each task.
-
Field Summary
Fields inherited from class gov.usgs.earthquake.distribution.ExecutorListenerNotifier
acceptBeforeQueuing, notificationListeners, retryTimer, throttleStartThreshold, throttleStopThreshold, throttleWaitInterval
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
queueNotification
(NotificationListener listener, NotificationEvent event) void
shutdown()
Stop any processing/background threads.void
startup()
Start any processing/background threads.Methods inherited from class gov.usgs.earthquake.distribution.ExecutorListenerNotifier
addNotificationListener, getExecutors, getMaxQueueSize, getMissingNotifications, getReceiver, getStatus, getThrottleStartThreshold, getThrottleStopThreshold, getThrottleWaitInterval, notifyListeners, notifyListeners, removeNotificationListener, setReceiver, setThrottleStartThreshold, setThrottleStopThreshold, setThrottleWaitInterval, throttleQueues, throttleQueues
Methods inherited from class gov.usgs.util.DefaultConfigurable
configure, getName, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface gov.usgs.util.Configurable
configure, getName, setName
-
Constructor Details
-
FutureListenerNotifier
Constructor- Parameters:
receiver
- DefaultNotificationReceiver
-
-
Method Details
-
queueNotification
- Overrides:
queueNotification
in classExecutorListenerNotifier
- Parameters:
listener
- NotificationListenerevent
- NotificationEvent
-
shutdown
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classExecutorListenerNotifier
- Throws:
Exception
- if exceptions occur while starting.
-
startup
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classExecutorListenerNotifier
- Throws:
Exception
- if exceptions occur while starting.
-