@@ -0,0 +1,2919 @@
+/*%0A * The MIT License%0A *%0A * Copyright 2015 avm.%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in%0A * all copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN%0A * THE SOFTWARE.%0A */%0Apackage jpt.app01;%0A%0Aimport java.io.IOException;%0Aimport java.net.InetSocketAddress;%0Aimport java.util.concurrent.Executors;%0A%0Aimport com.sun.net.httpserver.HttpServer;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.logging.Logger;%0A%0Apublic class Main %7B%0A  private static final Logger LOG = Logger.getLogger(Main.class.getName());%0A%0A  private static final int DEFAULT_QUEUE_SIZE = 0;%0A  private static final int DEFAULT_POOL_SIZE = 5;%0A  private static final int DEFAULT_PORT_NUMBER = 7666;%0A%0A  public static void main(String%5B%5D args) throws IOException %7B%0A    int portNumber = DEFAULT_PORT_NUMBER;%0A    int queueSize = DEFAULT_QUEUE_SIZE;%0A    int poolSize = DEFAULT_POOL_SIZE;%0A    for (String arg : args) %7B%0A      if (arg.startsWith(%22-p%22)) %7B%0A        portNumber = Integer.parseInt(arg.replaceFirst(%22%5C%5C-p%22, %22%22));%0A      %7D else if (arg.startsWith(%22-q%22)) %7B%0A        queueSize = Integer.parseInt(arg.replaceFirst(%22%5C%5C-q%22, %22%22));%0A      %7D else if (arg.startsWith(%22-t%22)) %7B%0A        poolSize = Integer.parseInt(arg.replaceFirst(%22%5C%5C-t%22, %22%22));%0A      %7D else %7B%0A        System.err.println(%22Usage: java %22 + Main.class.getName() + %22 %5Boption...%5D%22);%0A        System.err.println(%22Options: %22);%0A        System.err.println(%22    -p%3Ci%3E  change the listen port number (%22 + DEFAULT_PORT_NUMBER +%22)%22);%0A        System.err.println(%22    -q%3Ci%3E  change the queue size (%22 + DEFAULT_QUEUE_SIZE + %22)%22);%0A        System.err.println(%22    -t%3Ci%3E  change the threads pool size (%22 + DEFAULT_POOL_SIZE + %22)%22);%0A        System.exit(1);%0A      %7D%0A    %7D%0A    HttpServer server = HttpServer.create(new InetSocketAddress(portNumber), queueSize);%0A%0A    final ExecutorService threadPool = Executors.newFixedThreadPool(poolSize);%0A    server.setExecutor(threadPool);%0A    server.start();%0A    LOG.info(%22Server is listening on port %22 + portNumber);%0A  %7D%0A%0A%7D%0A

add launch/server class