I am learning to use ExectorService
to pool threads
and send out tasks. I have a simple program below
import java.util.concurrent.Execu
The difference is that execute
simply starts the task without any further ado, whereas submit
returns a Future
object to manage the task. You can do the following things with the Future
object:
cancel
method.get
.The Future
interface is more useful if you submit a Callable
to the pool. The return value of the call
method will be returned when you call Future.get
. If you don't maintain a reference to the Future
, there is no difference.