SOLR-10643: Unset hasPendingActions flag after all actions have been run

This commit is contained in:
Shalin Shekhar Mangar 2017-05-15 18:59:52 +05:30
parent 1f3f50745a
commit 607184c47e
1 changed files with 13 additions and 11 deletions

View File

@ -120,18 +120,20 @@ public class ScheduledTriggers implements Closeable {
if (actions != null) { if (actions != null) {
actionExecutor.submit(() -> { actionExecutor.submit(() -> {
assert hasPendingActions.get(); assert hasPendingActions.get();
// let the action executor thread wait instead of the trigger thread so we use the throttle here try {
actionThrottle.minimumWaitBetweenActions(); // let the action executor thread wait instead of the trigger thread so we use the throttle here
actionThrottle.markAttemptingAction(); actionThrottle.minimumWaitBetweenActions();
for (TriggerAction action : actions) { actionThrottle.markAttemptingAction();
try { for (TriggerAction action : actions) {
action.process(event); try {
} catch (Exception e) { action.process(event);
log.error("Error executing action: " + action.getName() + " for trigger event: " + event, e); } catch (Exception e) {
throw e; log.error("Error executing action: " + action.getName() + " for trigger event: " + event, e);
} finally { throw e;
hasPendingActions.set(false); }
} }
} finally {
hasPendingActions.set(false);
} }
}); });
} }