}
}
}
env.setStatus(ServerEnvironment.Status.starting);
events.send(new Event(EventTypes.SERVER_STARTUP), false);
// finally let's calculate our starting times
logger.info(localStrings.getLocalString("startup_end_message",
"{0} ({1}) startup time : {2} ({3}ms), startup services({4}ms), total({5}ms)",
version.getVersion(), version.getBuildVersion(), platform,
(platformInitTime - context.getCreationTime()),
(System.currentTimeMillis() - platformInitTime),
System.currentTimeMillis() - context.getCreationTime()));
printModuleStatus(systemRegistry, level);
try {
// it will only be set when called from AsadminMain and the env. variable AS_DEBUG is set to true
long realstart = Long.parseLong(System.getProperty("WALL_CLOCK_START"));
logger.info("TOTAL TIME INCLUDING CLI: " + (System.currentTimeMillis() - realstart));
}
catch(Exception e) {
}
if (logger.isLoggable(level)) {
for (Map.Entry<Class, Long> service : servicesTiming.entrySet()) {
logger.info("Service : " + service.getKey() + " took " + service.getValue() + " ms");
}
}
// all the synchronous and asynchronous services have started correctly, time to check
// if a severe error happened that should trigger shutdown.
if (shutdownRequested) {
shutdown();
} else {
for (Future<Result<Thread>> future : futures) {
try {
try {
// wait for 3 seconds for an eventual status, otherwise ignore
if (future.get(3, TimeUnit.SECONDS).isFailure()) {
final Throwable t = future.get().exception();
logger.log(Level.SEVERE,
localStrings.getLocalString("startupfatalstartup",
"Shutting down v3 due to startup exception : ",
t.getMessage()));
logger.log(Level.FINE, future.get().exception().getMessage(), t);
events.send(new Event(EventTypes.SERVER_SHUTDOWN));
shutdown();
return;
}
} catch(TimeoutException e) {
logger.warning(localStrings.getLocalString("startupwaittimeout",
"Timed out, ignoring some startup service status"));
}
} catch(Throwable t) {
logger.log(Level.SEVERE, t.getMessage(), t);
}
}
}
env.setStatus(ServerEnvironment.Status.started);
events.send(new Event(EventTypes.SERVER_READY), false);
pidWriter.writePidFile();
// now run the post Startup service
for (Inhabitant<? extends PostStartup> postStartup : habitat.getInhabitants(PostStartup.class)) {
postStartup.get();