I am trying to understand the behaviour of the executor service relative to shutdown. The documentation says that the application won't terminate unless there is a shutdown() call - but in this simple example. It exits after one minute precisely. Any idea?
Runnable r = new Runnable() {
@Override
public void run() {
Print.println("do nothing");
}
};
ThreadFactory TF = (Runnable run) -> new Thread(run);
ExecutorService exec = Executors.newCachedThreadPool(TF);
exec.submit(r);
returns this: 11:34:00.421 : Thread-0: do nothing BUILD SUCCESSFUL (total time: 1 minute 0 seconds)