RetrieverForReddit/src/main/java/com/kdepagter/processor/RedditRequestProcessor.java
/**
	 * Handles execution of SubredditProcessorThread for each desired subreddit
	 * Terminates after all Threads complete or 5 seconds expire
	 * @param subredditNameList - List<String> subreddit names 
	 * @throws Exception
	 */
Handles execution of SubredditProcessorThread for each desired subreddit
Terminates after all Threads complete or 5 seconds expire
@param subredditNameList - List subreddit names
@throws Exception
Handles execution of SubredditProcessorThread for each desired subreddit Terminates after all Threads complete or 5 seconds expire @param subredditNameList - List subreddit names @throws Exception
private void callSubredditProcessors(List<String> subredditNameList, ExecutorService executor) throws Exception{
		ecs = new ExecutorCompletionService<String>(executor);
		List<Future<String>> futureList = new ArrayList<Future<String>>();
		int numberOfRequests = subredditNameList.size();
		for(int i=0; i<numberOfRequests; i++){
			String currentSubreddit = subredditNameList.get(i);
			SubredditProcessorThread currentThread = new SubredditProcessorThread(currentSubreddit, this);
			futureList.add(ecs.submit(currentThread, currentSubreddit));
		}
		for(int i=0; i<numberOfRequests; i++){
			Future<String> currentResponse = ecs.poll(1, TimeUnit.SECONDS);
			if(currentResponse == null){
				log.info("Timed out waiting for subreddit response on iteration: " + Integer.toString(i));
			}
		}
		ecs = null;
	}
private void callSubredditProcessors ( List < String > subredditNameList , ExecutorService executor ) throws Exception { ecs = new ExecutorCompletionService < String > ( executor ) ; List < Future < String > > futureList = new ArrayList < Future < String > > ( ) ; int numberOfRequests = subredditNameList . size ( ) ; for ( int i = 0 ; i < numberOfRequests ; i ++ ) { String currentSubreddit = subredditNameList . get ( i ) ; SubredditProcessorThread currentThread = new SubredditProcessorThread ( currentSubreddit , this ) ; futureList . add ( ecs . submit ( currentThread , currentSubreddit ) ) ; } for ( int i = 0 ; i < numberOfRequests ; i ++ ) { Future < String > currentResponse = ecs . poll ( 1 , TimeUnit . SECONDS ) ; if ( currentResponse == null ) { log . info ( "Timed out waiting for subreddit response on iteration: " + Integer . toString ( i ) ) ; } } ecs = null ; }
Handles execution of SubredditProcessorThread for each desired subreddit
 Terminates after all Threads complete or 5 seconds expire
 @param subredditNameList - List<String> subreddit names
 @throws Exception
Handles execution of SubredditProcessorThread for each desired subreddit Terminates after all Threads complete or 5 seconds expire @param subredditNameList - List<String > subreddit names @throws Exception