I have submitted a task using executors and I need it to stop after some time (e.g. 5 minutes). I have tried doing like this:
for (Future> fut : e
Put the fut.cancel(true); in the finally block
fut.cancel(true);