Professional Documents
Culture Documents
Difference Between Executor Exe Service
Difference Between Executor Exe Service
Java
From Java 1.5, it was the application programmer's responsibility to create and
manage such thread pool but from JDK 5 onward Executor framework provides a
variety of built-in thread pools in Java e.g. fixed thread pool which contains a fixed
number of threads and cached thread pool which can spawn new threads when
needed.
The Future object provides the facility of asynchronous execution, which means you
don't need to wait until the execution finishes, you can just submit the task and go
around, come back and check if the Future object has the result, if the execution is
completed then it would have a result which you can access by using
the Future.get() method. Just remember that this method is a blocking
method i.e. it will wait until execution finish and the result is available if it's not
finished already.
And, if you are serious about mastering Java multi-threading and concurrency then I
also suggest you take a look at the Java Multithreading, Concurrency, and
Performance Optimization course by Michael Pogrebinsy on Udemy. It's an
advanced course to become an expert in Multithreading, concurrency, and Parallel
programming in Java with a strong emphasis on high performance.
Summary
You can further check out these online courses to learn more about thread-pools and
other essential concurrency concepts in Java.