org.actioncontrollerdemo.jdkhttp.JdkHttpMain Maven / Gradle / Ivy
package org.actioncontrollerdemo.jdkhttp;
import org.actioncontroller.config.ConfigObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JdkHttpMain {
private static final Logger logger = LoggerFactory.getLogger(JdkHttpMain.class);
private static DemoServer httpServer;
public synchronized static void main(String[] args) throws InterruptedException {
new JdkHttpMain().start();
JdkHttpMain.class.wait();
}
private void start() {
ConfigObserver config = new ConfigObserver("demoserver");
config.onInetSocketAddress("httpSocketAddress", inetSocketAddress -> {
DemoServer oldServer = httpServer;
httpServer = new DemoServer(inetSocketAddress);
httpServer.start();
logger.warn("Started on {}", httpServer.getURL());
if (oldServer != null) {
oldServer.stop(2);
}
}, 20080);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy