Throw an exception if no cleanup hook was registered.

This commit is contained in:
akwizgran
2021-02-26 11:49:54 +00:00
committed by Torsten Grote
parent f0e4e3c164
commit e4da7968e3

View File

@@ -148,12 +148,9 @@ class CleanupManagerImpl implements CleanupManager, Service, EventListener {
} }
CleanupHook hook = hooks.get(cv); CleanupHook hook = hooks.get(cv);
if (hook == null) { if (hook == null) {
if (LOG.isLoggable(WARNING)) { throw new IllegalStateException("No cleanup hook for " + cv);
LOG.warning("No cleanup hook for " + cv); }
} if (hook.deleteMessage(txn, g, m)) {
// Stop the timer so we don't keep trying to delete this message
db.stopCleanupTimer(txn, m);
} else if (hook.deleteMessage(txn, g, m)) {
Collection<MessageId> messageIds = deleted.get(g); Collection<MessageId> messageIds = deleted.get(g);
if (messageIds == null) { if (messageIds == null) {
messageIds = new ArrayList<>(); messageIds = new ArrayList<>();