Java 类org.apache.http.ExceptionLogger 实例源码

项目:AwesomeJavaLibraryExamples    文件:HTTPServer.java   
public static void main(String[] args) throws InterruptedException, IOException
{
   try
   {
      IOReactorConfig config = IOReactorConfig.custom().setSoTimeout(15000).setTcpNoDelay(true).build();
      final HttpServer server = ServerBootstrap.bootstrap().setListenerPort(PORT).setServerInfo("Test/1.1").setIOReactorConfig(config).setExceptionLogger(ExceptionLogger.STD_ERR).registerHandler("*", new HTTPTimeHandler()).create();

      server.start();

      System.out.println("Server started");

      Runtime.getRuntime().addShutdownHook(new Thread()
      {
         @Override public void run()
         {
            System.out.println("Server shutdown requested");
            server.shutdown(5, TimeUnit.SECONDS);
         }
      });

      server.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
   }
   finally
   {
      System.out.println("Server shutdown");
   }
}