コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 public void shutdown() {
   server.shutdown();
 }
コード例 #4
0
 public HttpServerSimulator shutdown() {
   server.shutdown();
   return this;
 }
コード例 #5
0
 public HttpServerSimulator start() {
   server.startAsDeamon();
   return this;
 }