use of com.github.robozonky.app.management.Management in project robozonky by RoboZonky.
the class App method execute.
private static ReturnCode execute(final InvestmentMode mode) {
App.SHUTDOWN_HOOKS.register(() -> Optional.of((r) -> Scheduler.inBackground().close()));
Events.fire(new RoboZonkyStartingEvent());
try {
ensureLiveness();
Scheduler.inBackground().submit(new UpdateMonitor(), Duration.ofDays(1));
App.SHUTDOWN_HOOKS.register(new Management(LIFECYCLE));
final String sessionName = Events.getSessionInfo().flatMap(SessionInfo::getName).orElse(null);
App.SHUTDOWN_HOOKS.register(new RoboZonkyStartupNotifier(sessionName));
return mode.apply(LIFECYCLE);
} catch (final Throwable t) {
LOGGER.error("Caught unexpected exception, terminating daemon.", t);
return ReturnCode.ERROR_UNEXPECTED;
}
}
Aggregations