diff --git a/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/runtime/config/StrolchConfiguration.xml b/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/runtime/config/StrolchConfiguration.xml index 86cfbd9b7..85305a07c 100644 --- a/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/runtime/config/StrolchConfiguration.xml +++ b/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/runtime/config/StrolchConfiguration.xml @@ -6,6 +6,7 @@ en true + Europe/Zurich diff --git a/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/Main.java b/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/Main.java index b8d7172f6..48bbf83e1 100644 --- a/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/Main.java +++ b/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/Main.java @@ -33,18 +33,16 @@ public class Main { throw e; } - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - try { - Thread.sleep(200); - System.out.println("Shutting down ..."); - Main.agent.stop(); - Main.agent.destroy(); - } catch (InterruptedException e) { - logger.error("Failed to stop " + APP_NAME + " due to " + e.getMessage(), e); - } + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + Thread.sleep(200); + System.out.println("Shutting down ..."); + Main.agent.stop(); + Main.agent.destroy(); + } catch (InterruptedException e) { + logger.error("Failed to stop " + APP_NAME + " due to " + e.getMessage(), e); } - }); + })); long took = System.currentTimeMillis() - start; logger.info("Started " + APP_NAME + " in " + (StringHelper.formatMillisecondsDuration(took))); diff --git a/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/PostInitializer.java b/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/PostInitializer.java index 4e09cbb0d..8174aa8d1 100644 --- a/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/PostInitializer.java +++ b/li.strolch.mvn.archetype.main/src/main/resources/archetype-resources/src/main/java/PostInitializer.java @@ -24,6 +24,13 @@ public class PostInitializer extends SimplePostInitializer { @Override public void start() throws Exception { + registerJobs(); + notifyStart(); + + super.start(); + } + + private void registerJobs() throws Exception { if (!getContainer().hasComponent(StrolchJobsHandler.class)) return; @@ -45,10 +52,6 @@ public class PostInitializer extends SimplePostInitializer { JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS); jobsHandler.register(archiveExecutedActivitiesJob).runNow(); } - - notifyStart(); - - super.start(); } private void notifyStart() { diff --git a/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/java/PostInitializer.java b/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/java/PostInitializer.java index 4e09cbb0d..8174aa8d1 100644 --- a/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/java/PostInitializer.java +++ b/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/java/PostInitializer.java @@ -24,6 +24,13 @@ public class PostInitializer extends SimplePostInitializer { @Override public void start() throws Exception { + registerJobs(); + notifyStart(); + + super.start(); + } + + private void registerJobs() throws Exception { if (!getContainer().hasComponent(StrolchJobsHandler.class)) return; @@ -45,10 +52,6 @@ public class PostInitializer extends SimplePostInitializer { JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS); jobsHandler.register(archiveExecutedActivitiesJob).runNow(); } - - notifyStart(); - - super.start(); } private void notifyStart() {