ThreadPool.getThreadPool().setIdleMin(4);
ThreadPool.getThreadPool().setPriorityIdleMin(4);
ResinELContext elContext = _args.getELContext();
Resin resin = Resin.createWatchdog(_system);
if (_args.getDataDirectory() != null)
resin.setDataDirectory(_args.getDataDirectory());
resin.preConfigureInit();
// XXX: needs to be config
InjectManager cdiManager = InjectManager.create();
Config.setProperty("resinHome", elContext.getResinHome());
Config.setProperty("resin", elContext.getResinVar());
Config.setProperty("server", elContext.getServerVar());
Config.setProperty("java", elContext.getJavaVar());
Config.setProperty("system", System.getProperties());
Config.setProperty("getenv", System.getenv());
ResinConfigLibrary.configure(cdiManager);
_watchdogPort = _args.getWatchdogPort();
readConfig(_args);
WatchdogChild server = null;
String serverId = _args.getServerId();
if (_args.isDynamicServer()) {
serverId = _args.getDynamicServerId();
}
server = _watchdogMap.get(_args.getServerId());
if (server == null)
throw new IllegalStateException(L().l("'{0}' is an unknown server",
serverId));
JniBoot boot = new JniBoot();
Path logDirectory = getLogDirectory();
if (boot.isValid()) {
if (! isLogDirectoryExists) {
logDirectory.mkdirs();
boot.chown(logDirectory, server.getUserName(), server.getGroupName());
}
}
server.getConfig().logInit(logStream);
resin.preConfigureInit();
resin.setConfigFile(_args.getResinConf().getNativePath());
thread = Thread.currentThread();
thread.setContextClassLoader(resin.getClassLoader());
CloudSystem cloudSystem = TopologyService.getCurrent().getSystem();
CloudCluster cluster = cloudSystem.createCluster("watchdog");
CloudPod pod = cluster.createPod();
pod.createStaticServer("default", "localhost", -1, false);
_server = resin.createServer();
thread.setContextClassLoader(_server.getClassLoader());
NetworkListenSystem listenService