I have a class A that implements Runnable interface, this class perform my batch job. Their is a controller class which is responsible for creating ExecutorService and submitting objects of Class A to ExecutorService instance in a for loop.
I want to terminated the execution of all task, if any task execution encounters exception as their is high probability that the exception will be caused in all task and I want the cause to be thrown to caller code.
How can I achieve this ?