Java Multithreading Like Map Reduce API