class ThreadsEngine {

	public static void setNumberOfThreads(int numThreads) {
		if (numThreads < 1)
			throw new IllegalStateException("Number of threads must be a positive integer.");
		
		if (threadPool.size() > numThreads)
			throw new IllegalStateException("You cannot set a numThreads smaller than the current size of the threads pool.");
		
		if (threadPool.size() < numThreads) {
			for (int i=threadPool.size(); i<numThreads; i++) {
				threadPool.add(Executors.newSingleThreadExecutor());
			}
		}
	}

}