Wednesday, 14 August 2013

Cancelling group of threads if one of the thread finishes

Cancelling group of threads if one of the thread finishes

I am trying to figure out the solution for a scenario of cancelling a
group of threads if one of the Thread finishes the task successfully.
The scenario is like this: Lets say a group of threads are working on a
task to find a String in a file and if any of the thread finds the String,
the remaining treads should stop execution.
Using 1.5 concurrency we can achieve this, but prior to JDK 1.5 if we want
to achieve this kind of scenario, then how can we do that?

No comments:

Post a Comment