|Executors in the Middle Ages|
Futureto demonstrate the concurrency libraries in Java.
In the example, I use a
ExecutorServicewith a fixed thread pool size of two (2), to make the code slower to demonstrate the point. You can manipulate the value to see the effect on the code execution.
The code is to demonstrate you can do it, there may be other cleaner ways of doing this. If you have an example, or idea on how to do it cleaner, please comment. :-)
SolutionThe code for the project was developed using NetBeans and can be downloaded from Bitbucket at the link below. It is a NetBeans (Apache Ant) based project and should work with Ant without NetBeans.