public HttpServerSimulator(int numOfWorkers, int minProcessTime, int maxProcessTime) { server = new HttpServer(); handler = new MessageHandler(); server.add("/message", handler); server.setPort(7080); server.setNumberOfWorkers(numOfWorkers); handler.setMinProcessTime(minProcessTime); handler.setMaxProcessTime(maxProcessTime); }
public SparknginServer() throws Exception { FileUtil.removeIfExist("build/queue", false); forwarder = new NullDevMessageForwarder(); server = new HttpServer(); server.setPort(7080); metricRegistry = new MetricRegistry(); server.add( "/message/json", new JSONMessageRouteHandler(new Sparkngin(metricRegistry, forwarder, "build/queue/data"))); server.setDefault(new StaticFileHandler(".")); server.startAsDeamon(); Thread.sleep(2000); }