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 voidqueueNotification(NotificationListener listener, NotificationEvent event) voidshutdown()Stop any processing/background threads.voidstartup()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, throttleQueuesMethods inherited from class gov.usgs.util.DefaultConfigurable
configure, getName, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.usgs.util.Configurable
configure, getName, setName
-
Constructor Details
-
FutureListenerNotifier
Constructor- Parameters:
receiver- DefaultNotificationReceiver
-
-
Method Details
-
queueNotification
- Overrides:
queueNotificationin classExecutorListenerNotifier- Parameters:
listener- NotificationListenerevent- NotificationEvent
-
shutdown
Description copied from class:DefaultConfigurableStop any processing/background threads.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin classExecutorListenerNotifier- Throws:
Exception- if exceptions occur while starting.
-
startup
Description copied from class:DefaultConfigurableStart any processing/background threads.- Specified by:
startupin interfaceConfigurable- Overrides:
startupin classExecutorListenerNotifier- Throws:
Exception- if exceptions occur while starting.
-