[Project] updated strolch maven archetypes

This commit is contained in:
Robert von Burg 2019-09-25 11:16:00 +02:00
parent 2f6b7e7b05
commit d9aadc61f5
4 changed files with 24 additions and 19 deletions

View File

@ -6,6 +6,7 @@
<Properties> <Properties>
<locale>en</locale> <locale>en</locale>
<verbose>true</verbose> <verbose>true</verbose>
<timezone>Europe/Zurich</timezone>
</Properties> </Properties>
</Runtime> </Runtime>
<Component> <Component>

View File

@ -33,18 +33,16 @@ public class Main {
throw e; throw e;
} }
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread(() -> {
public void run() { try {
try { Thread.sleep(200);
Thread.sleep(200); System.out.println("Shutting down ...");
System.out.println("Shutting down ..."); Main.agent.stop();
Main.agent.stop(); Main.agent.destroy();
Main.agent.destroy(); } catch (InterruptedException e) {
} catch (InterruptedException e) { logger.error("Failed to stop " + APP_NAME + " due to " + e.getMessage(), e);
logger.error("Failed to stop " + APP_NAME + " due to " + e.getMessage(), e);
}
} }
}); }));
long took = System.currentTimeMillis() - start; long took = System.currentTimeMillis() - start;
logger.info("Started " + APP_NAME + " in " + (StringHelper.formatMillisecondsDuration(took))); logger.info("Started " + APP_NAME + " in " + (StringHelper.formatMillisecondsDuration(took)));

View File

@ -24,6 +24,13 @@ public class PostInitializer extends SimplePostInitializer {
@Override @Override
public void start() throws Exception { public void start() throws Exception {
registerJobs();
notifyStart();
super.start();
}
private void registerJobs() throws Exception {
if (!getContainer().hasComponent(StrolchJobsHandler.class)) if (!getContainer().hasComponent(StrolchJobsHandler.class))
return; return;
@ -45,10 +52,6 @@ public class PostInitializer extends SimplePostInitializer {
JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS); JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS);
jobsHandler.register(archiveExecutedActivitiesJob).runNow(); jobsHandler.register(archiveExecutedActivitiesJob).runNow();
} }
notifyStart();
super.start();
} }
private void notifyStart() { private void notifyStart() {

View File

@ -24,6 +24,13 @@ public class PostInitializer extends SimplePostInitializer {
@Override @Override
public void start() throws Exception { public void start() throws Exception {
registerJobs();
notifyStart();
super.start();
}
private void registerJobs() throws Exception {
if (!getContainer().hasComponent(StrolchJobsHandler.class)) if (!getContainer().hasComponent(StrolchJobsHandler.class))
return; return;
@ -45,10 +52,6 @@ public class PostInitializer extends SimplePostInitializer {
JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS); JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS);
jobsHandler.register(archiveExecutedActivitiesJob).runNow(); jobsHandler.register(archiveExecutedActivitiesJob).runNow();
} }
notifyStart();
super.start();
} }
private void notifyStart() { private void notifyStart() {