This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: Java ExecutorCompletionService example
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see about Java ExecutorCompletionService example. ExecutorCompletionService class implements CompletionService. This class returns Future object in completion order. Why you may need to use ExecutorCompletionService: Let’s understand with the help of scenario: Let’s say you have 5 tasks, you submit it to the executors and you want to perform some operation as soon as task completes.Let’s also assume that the first task takes the longest time. If you use Executors in this case, when you call future.get() on the first task, get operation will be blocked and even though other tasks may have completed, you won’t be able