/*
 * Copyright 2013 Charles University in Prague
 * Copyright 2013 Vojtech Horky
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cz.cuni.mff.d3s.spl.demo.imagequality;

import java.io.IOException;
import java.net.InetSocketAddress;

import com.sun.net.httpserver.HttpServer;

import cz.cuni.mff.d3s.spl.demo.imagequality.html.GraphHandler;

public class Main {
	public static void main(String[] args) throws IOException {
		InetSocketAddress addr = new InetSocketAddress(8888);
		HttpServer server = HttpServer.create(addr, 10);
		server.createContext("/", new GraphHandler());
		server.setExecutor(null);
		
		server.start();
		
		System.out.println("Listening on localhost:8888. Hit <Enter> to terminate.");
		
		try {
			System.in.read();
		} catch (IOException e) {
		}
		
		System.out.println("Terminating...");
		
		server.stop(0);
	}
}

@@ -748,16 +748,111 @@
 Address;
+%0Aimport java.util.concurrent.Executor;%0Aimport java.util.concurrent.ScheduledThreadPoolExecutor;
 %0A%0Aimport
@@ -1138,16 +1138,76 @@
 addr, 10
+0);%0A%09%09Executor executor = new ScheduledThreadPoolExecutor(20
 );%0A%09%09ser
@@ -1275,12 +1275,16 @@
 tor(
-null
+executor
 );%0A%09

scale a bit better