I have the code below, where executor is type ExecutorService:
Runnable worker = new MyRunnable(x, y, p);
                executor.execute(worker);
When a number prints p times, i want the execution of all threads to be terminated cleanly without waiting the other threads to finish their jobs. How can i do that?
 
     
    