Improve Requeuing Exception Handling
- Relevant file: src/main/java/gov/usgs/earthquake/distribution/ExecutorListenerNotifier.java
- Relevant method: startup
Currently, if an exception occurs while attempting to query for missing notifications, a message is printed and a list of 0 notifications is returned to the ExecutorListenerNotifier. This list of 0 notifications is then "requeued" to the listener and processing continues as-if the missing notifications had been found. This causes the listener to potentially not receive/process some notifications since they may exist, but an exception prevented their discovery.
If an exception occurs finding notifications, the ExecutorListenerNotifier should be aware something went wrong and either try to find missing notifications again, or cause the startup sequence to abort. If retrying, consider a maxAttempts
configuration property to prevent an infinite loop at this stage. Appropriate logging should be included:
-
Log number of missing notifications found for requeuing -
Log a retry and attempt count -
On (eventual) exception, do not start the client -
Other logging as appropriate