WaitForMultipleObject feature in Java
Current, I have a method, which will perform lock on
void MyWait()
{
CountDownLatch.aWait
// We can have access to the Stop lock.
}
void MyStop()
{
// Signal Stop lock.
}
This works fine until we need to stop the thread from keep waiting on CountDownLatch, when there is a stop signal. (The method who send stop signal doesn't have access to CountDownLatch, else, the stop method can just directly signal the CountDownLatch)
We would like to have something, "if either CountDownLatch is signaled or Stop lock is signaled", unblock the thread.
Perhaps something like
WaitForMultipleObject(CountDownLatch, StopLock) in method void MyWait()
either one of the object being signaled, the thread will continue execution.
May I know how can I do that in Java?
One of the solution is that I can interrupt the Thread which is halted at line CountDownLatch.aWait. However, I have no access to the Thread which halted at line CountDownLatch.aWait

