use of net.robinfriedli.aiode.command.CommandManager in project aiode by robinfriedli.
the class SpringBootstrap method run.
@Override
public void run(String... args) {
Logger logger = LoggerFactory.getLogger(SpringBootstrap.class);
logger.info("Using java version " + System.getProperty("java.runtime.version"));
try {
Aiode aiode = Aiode.get();
CommandManager commandManager = aiode.getCommandManager();
HttpServerManager serverManager = aiode.getHttpServerManager();
JxpBackend jxpBackend = aiode.getJxpBackend();
CronJobService cronJobService = aiode.getCronJobService();
commandManager.initializeInterceptorChain();
serverManager.start();
// run startup tasks
InputStream startupTasksFile = getClass().getResourceAsStream("/xml-contributions/startupTasks.xml");
Context context = jxpBackend.createContext(startupTasksFile);
for (StartupTaskContribution element : context.getInstancesOf(StartupTaskContribution.class)) {
if (!aiode.isMainInstance() && element.getAttribute("mainInstanceOnly").getBool()) {
continue;
}
if (!element.getAttribute("runForEachShard").getBool()) {
element.instantiate().runTask(null);
}
}
cronJobService.scheduleAll();
Aiode.registerListeners();
logger.info("All starters done");
} catch (Throwable e) {
logger.error("Exception in starter. Application will terminate.", e);
System.exit(1);
}
}
Aggregations