I've read a couple of articles about the new concurrency features introduced in Java 5, and it got my attention. There are a lot of new features, like thread pools, semaphores and a lot more. The most interesting and the most widely used feature, I think, is the Executor interface.
The Executor interface helps you seperate task submission from task execution. The java.util.concurrent package provides a couple of default implementations of the Executor interface, which allows you to submit tasks and which are then run by the Executor implementation. Tasks can be good old Runnables or new Callables.
Overall, I think the new concurrency utilities are very powerful and make programmers life easier!
I made a small example using a couple of new concurrency features. For further details, check the readme file that comes along with my example. It is available through bittorrent and my download site.
No comments:
Post a Comment