public static void main(String[] args) throws InterruptedException, ExecutionException {
		long d1 = System.currentTimeMillis();
		WriteFileTest test = new WriteFileTest();
		
		List<ICommand> commands = new ArrayList<ICommand>();
		List<Future<String>> computes = new ArrayList<Future<String>>();
		List<Future<Object>> writeFiles = new ArrayList<Future<Object>>();
		
		ExecutorService computeService = Executors.newFixedThreadPool(5);
		ExecutorService writeService = Executors.newFixedThreadPool(2);
		
		for(int i = 0; i < 10; i++) {
			computes.add(computeService.submit(new ThreadTest(threadIndex++)));
		}
		computeService.shutdown();
		
		Iterator<Future<String>> computesIterator;
		Future<String> computeFuture;
		Iterator<Future<Object>> writeFilesIterator;
		Future<Object> writeFileFuture;
		while(true) {
			if(computes.size() == 0 && commands.size() == 0) {
				break;
			}
			
			computesIterator = computes.iterator();
			while(computesIterator.hasNext()) {
				computeFuture = computesIterator.next();
				if(computeFuture.isDone()) {
					writeFiles.add(writeService.submit(new WriteFileCommond(new WriteFile(computeFuture.get(), test.getWriteFile()))));
					computesIterator.remove();
				}
			}
			
			writeFilesIterator = writeFiles.iterator();
			while(writeFilesIterator.hasNext()) {
				writeFileFuture = writeFilesIterator.next();
				if(writeFileFuture.isDone()) {
					System.out.println(writeFileFuture.get() + " done.");
					writeFilesIterator.remove();
				}
			}
		}
		
		writeService.shutdown();
		long d2 = System.currentTimeMillis();
		System.out.println("Multi Thread : " + (d2 - d1));
	}