DaemonServices daemonServices = new DaemonServices(parameters, loggingRegistry, loggingManager);
File daemonLog = daemonServices.getDaemonLogFile();
initialiseLogging(loggingManager, daemonLog);
Daemon daemon = daemonServices.get(Daemon.class);
daemon.start();
try {
DaemonContext daemonContext = daemonServices.get(DaemonContext.class);
Long pid = daemonContext.getPid();
daemonStarted(pid, daemon.getUid(), daemon.getAddress(), daemonLog);
// Block until idle
daemon.requestStopOnIdleTimeout(parameters.getIdleTimeout(), TimeUnit.MILLISECONDS);
} finally {
daemon.stop();
}
}