What is the difference between ExecutorService.submit and ExecutorService.execute in this code in Java?
As you see from the JavaDoc execute(Runnable) does not return anything. However, submit(Callable<T>) returns a Future object which allows a way for you to programatically cancel the running thread later as well as get the T that is returned when the Callable completes. See JavaDoc of Future for more details Future<?> future = executor.submit(longRunningJob); … … Read more