SOLR-10738: TriggerAction is initialised even if the trigger is never scheduled

This commit is contained in:
Shalin Shekhar Mangar 2017-05-24 14:38:26 +05:30
parent cfe5cffddd
commit b010ebd515
5 changed files with 9 additions and 5 deletions

View File

@ -107,6 +107,8 @@ Bug Fixes
* SOLR-10714: OverseerTriggerThread does not start triggers on overseer start until autoscaling
config watcher is fired. (shalin)
* SOLR-10738: TriggerAction is initialised even if the trigger is never scheduled. (shalin)
Optimizations
----------------------

View File

@ -70,7 +70,6 @@ public class NodeAddedTrigger implements AutoScaling.Trigger<NodeAddedTrigger.No
actions = new ArrayList<>(3);
for (Map<String, String> map : o) {
TriggerAction action = container.getResourceLoader().newInstance(map.get("class"), TriggerAction.class);
action.init(map);
actions.add(action);
}
} else {

View File

@ -70,7 +70,6 @@ public class NodeLostTrigger implements AutoScaling.Trigger<NodeLostTrigger.Node
actions = new ArrayList<>(3);
for (Map<String, String> map : o) {
TriggerAction action = container.getResourceLoader().newInstance(map.get("class"), TriggerAction.class);
action.init(map);
actions.add(action);
}
} else {

View File

@ -143,6 +143,10 @@ public class ScheduledTriggers implements Closeable {
return false;
}
});
List<TriggerAction> actions = newTrigger.getActions();
for (TriggerAction action : actions) {
action.init(newTrigger.getProperties());
}
scheduledTrigger.scheduledFuture = scheduledThreadPoolExecutor.scheduleWithFixedDelay(scheduledTrigger, 0, DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS, TimeUnit.SECONDS);
}

View File

@ -473,8 +473,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
public static class TestTriggerAction implements TriggerAction {
public TestTriggerAction() {
log.info("TestTriggerAction instantiated");
actionCreated.countDown();
}
@Override
@ -507,7 +506,8 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
@Override
public void init(Map<String, String> args) {
log.info("TestTriggerAction init");
actionCreated.countDown();
}
}
}