NissimShiman commented on code in PR #7232:
URL: https://github.com/apache/nifi/pull/7232#discussion_r1195555875
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/QuartzSchedulingAgent.java:
##########
@@ -71,37 +76,30 @@ public void doSchedule(final ReportingTaskNode taskNode,
final LifecycleState sc
@Override
public void run() {
- if (canceled.get()) {
- return;
- }
-
taskWrapper.run();
- if (canceled.get()) {
- return;
- }
-
nextSchedule = getNextSchedule(nextSchedule, cronExpression);
final long delay = getDelay(nextSchedule);
logger.debug("Finished running Reporting Task {}; next
scheduled time is at {} after a delay of {} milliseconds", taskNode,
nextSchedule, delay);
- flowEngine.schedule(this, delay, TimeUnit.MILLISECONDS);
+ final ScheduledFuture<?> newFuture = flowEngine.schedule(this,
delay, TimeUnit.MILLISECONDS);
+ final ScheduledFuture<?> oldFuture =
componentFuturesMap.put(0, newFuture);
+ scheduleState.replaceFuture(oldFuture, newFuture);
Review Comment:
Did some testing where task was stopped, new cron time was set and restarted
and it only ran on the new schedule (also did for a processor as well to test
parallel change made for that), so this does a nice job keeping track of that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]