mirror of https://github.com/apache/lucene.git
SOLR-10738: TriggerAction is initialised even if the trigger is never scheduled
This commit is contained in:
parent
cfe5cffddd
commit
b010ebd515
|
@ -107,6 +107,8 @@ Bug Fixes
|
||||||
* SOLR-10714: OverseerTriggerThread does not start triggers on overseer start until autoscaling
|
* SOLR-10714: OverseerTriggerThread does not start triggers on overseer start until autoscaling
|
||||||
config watcher is fired. (shalin)
|
config watcher is fired. (shalin)
|
||||||
|
|
||||||
|
* SOLR-10738: TriggerAction is initialised even if the trigger is never scheduled. (shalin)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class NodeAddedTrigger implements AutoScaling.Trigger<NodeAddedTrigger.No
|
||||||
actions = new ArrayList<>(3);
|
actions = new ArrayList<>(3);
|
||||||
for (Map<String, String> map : o) {
|
for (Map<String, String> map : o) {
|
||||||
TriggerAction action = container.getResourceLoader().newInstance(map.get("class"), TriggerAction.class);
|
TriggerAction action = container.getResourceLoader().newInstance(map.get("class"), TriggerAction.class);
|
||||||
action.init(map);
|
|
||||||
actions.add(action);
|
actions.add(action);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class NodeLostTrigger implements AutoScaling.Trigger<NodeLostTrigger.Node
|
||||||
actions = new ArrayList<>(3);
|
actions = new ArrayList<>(3);
|
||||||
for (Map<String, String> map : o) {
|
for (Map<String, String> map : o) {
|
||||||
TriggerAction action = container.getResourceLoader().newInstance(map.get("class"), TriggerAction.class);
|
TriggerAction action = container.getResourceLoader().newInstance(map.get("class"), TriggerAction.class);
|
||||||
action.init(map);
|
|
||||||
actions.add(action);
|
actions.add(action);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -143,6 +143,10 @@ public class ScheduledTriggers implements Closeable {
|
||||||
return false;
|
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);
|
scheduledTrigger.scheduledFuture = scheduledThreadPoolExecutor.scheduleWithFixedDelay(scheduledTrigger, 0, DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -473,8 +473,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
||||||
public static class TestTriggerAction implements TriggerAction {
|
public static class TestTriggerAction implements TriggerAction {
|
||||||
|
|
||||||
public TestTriggerAction() {
|
public TestTriggerAction() {
|
||||||
log.info("TestTriggerAction instantiated");
|
|
||||||
actionCreated.countDown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -507,7 +506,8 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Map<String, String> args) {
|
public void init(Map<String, String> args) {
|
||||||
|
log.info("TestTriggerAction init");
|
||||||
|
actionCreated.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue