I have the following Foo class that uses FooProcessor class. So what i want to do is, while running cp1 instance process method, in parallel I want
The way I would implement it, in summary :
ExecutorService executor = Executors.newFixedThreadPool(nThreads);future1 is the future linked to cp1get returns (cp1 has finished) cancel all the other futures, (or shutdownNow the executor service if you don't need the executor any longer)