Consider the following Java class:
public class Event \{
public synchronized void highPriorityWait();
public synchronized void lowPriorityWait();
public synchronized
void signalEvent();
\}
Show how this class be implemented so that signalEvent releases one highpriority waiting thread if one is waiting. If there is no high-priority waiting thread, release one low-priority waiting thread. If no thread is waiting, the signalEvent has no effect.
Now consider the case where an Id can be associated with the methods. How can the algorithm be modified so that the signalEvent wakes up the appropriate blocked thread?