File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
app/aem/core/src/main/java/com/cognifide/apm/core Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 23
23
import com .cognifide .apm .api .scripts .LaunchMode ;
24
24
import com .cognifide .apm .api .scripts .Script ;
25
25
import com .cognifide .apm .api .services .RunModesProvider ;
26
+ import java .util .Date ;
26
27
import java .util .Set ;
27
28
import java .util .function .Predicate ;
28
29
import org .apache .commons .lang3 .StringUtils ;
@@ -94,11 +95,14 @@ private static Predicate<Script> withLaunchMode(LaunchMode mode) {
94
95
}
95
96
96
97
private static Predicate <Script > withSchedule () {
97
- return script -> script .getLaunchMode () == LaunchMode .ON_SCHEDULE && script .getLaunchSchedule () != null ;
98
+ return script -> script .getLaunchMode () == LaunchMode .ON_SCHEDULE
99
+ && script .getLaunchSchedule () != null
100
+ && script .getLaunchSchedule ().after (new Date ());
98
101
}
99
102
100
103
private static Predicate <Script > withCronExpression () {
101
- return script -> script .getLaunchMode () == LaunchMode .ON_CRON_EXPRESSION && StringUtils .isNotEmpty (script .getLaunchCronExpression ());
104
+ return script -> script .getLaunchMode () == LaunchMode .ON_CRON_EXPRESSION
105
+ && StringUtils .isNotEmpty (script .getLaunchCronExpression ());
102
106
}
103
107
104
108
private static Predicate <Script > enabled () {
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ public void onChange(List<ResourceChange> changes) {
132
132
if (onScheduleOrCronExpression (runModesProvider ).test (script )) {
133
133
registerScript (script , bundleContext );
134
134
}
135
- } else if (!Objects .equals (script , registeredScript .script )) {
135
+ } else if (!Objects .equals (script , registeredScript .script ) || script . getLaunchMode () == LaunchMode . ON_SCHEDULE ) {
136
136
registeredScript .registration .unregister ();
137
137
registeredScripts .remove (change .getPath ());
138
138
if (onScheduleOrCronExpression (runModesProvider ).test (script )) {
You can’t perform that action at this time.
0 commit comments