@@ -132,15 +132,17 @@ public void onChange(List<ResourceChange> changes) {
132132 }
133133
134134 private void bootWhenInstanceUp () {
135- LOG .info ("Automatic scripts booting on instance up" );
135+ LOG .info ("Automatic scripts booting on instance up - job scheduling " );
136136 unscheduleBoot ();
137137 scheduleBoot ();
138+ LOG .info ("Automatic scripts booting on instance up - job scheduled" );
138139 }
139140
140141 private void bootWhenScriptsChanged () {
141- LOG .info ("Automatic scripts booting on script changes" );
142+ LOG .info ("Automatic scripts booting on script changes - job scheduling " );
142143 unscheduleBoot ();
143144 scheduleBoot ();
145+ LOG .info ("Automatic scripts booting on script changes - job scheduled" );
144146 }
145147
146148 private void unscheduleBoot () {
@@ -168,13 +170,15 @@ private ScheduleResult determineSchedule(Script script, ResourceResolver resourc
168170
169171 private Job bootJob () {
170172 return context -> {
173+ LOG .info ("Automatic scripts booting - job started" );
171174 unscheduleScripts ();
172175 if (awaitInstanceHealthy (
173176 "Automatic scripts queueing and scheduling" ,
174177 config .healthCheckRetryCountBoot (),
175178 config .healthCheckRetryInterval ())) {
176179 queueAndScheduleScripts ();
177180 }
181+ LOG .info ("Automatic scripts booting - job finished" );
178182 };
179183 }
180184
@@ -264,28 +268,28 @@ private void scheduleCronScript(Script script, CronSchedule schedule) {
264268
265269 private Job cronJob (String scriptPath ) {
266270 return context -> {
267- if (!awaitInstanceHealthy (
271+ LOG .info ("Cron schedule script '{}' - job started" , scriptPath );
272+ if (awaitInstanceHealthy (
268273 String .format ("Cron schedule script '%s' queueing" , scriptPath ),
269274 config .healthCheckRetryCountCron (),
270275 config .healthCheckRetryInterval ())) {
271- return ;
272- }
273-
274- try (ResourceResolver resourceResolver = ResolverUtils .contentResolver (resourceResolverFactory , null )) {
275- ScriptRepository scriptRepository = new ScriptRepository (resourceResolver );
276- Script script = scriptRepository .read (scriptPath ).orElse (null );
277- if (script == null ) {
278- LOG .error ("Cron schedule script '{}' not found in repository!" , scriptPath );
279- } else {
280- if (checkScript (script , resourceResolver )) {
281- queueScript (script );
276+ try (ResourceResolver resourceResolver = ResolverUtils .contentResolver (resourceResolverFactory , null )) {
277+ ScriptRepository scriptRepository = new ScriptRepository (resourceResolver );
278+ Script script = scriptRepository .read (scriptPath ).orElse (null );
279+ if (script == null ) {
280+ LOG .error ("Cron schedule script '{}' not found in repository!" , scriptPath );
282281 } else {
283- LOG .info ("Cron schedule script '{}' not eligible for queueing!" , scriptPath );
282+ if (checkScript (script , resourceResolver )) {
283+ queueScript (script );
284+ } else {
285+ LOG .info ("Cron schedule script '{}' not eligible for queueing!" , scriptPath );
286+ }
284287 }
288+ } catch (LoginException e ) {
289+ LOG .error ("Cannot access repository while queueing cron schedule script '{}'!" , scriptPath , e );
285290 }
286- } catch (LoginException e ) {
287- LOG .error ("Cannot access repository while queueing cron schedule script '{}'!" , scriptPath , e );
288291 }
292+ LOG .info ("Cron schedule script '{}' - job finished" , scriptPath );
289293 };
290294 }
291295
0 commit comments