FileDocCategorySizeDatePackage
PassiveRequestQueue.javaAPI DocExample506Thu Dec 24 20:59:36 GMT 1998tuning.server

PassiveRequestQueue.java

package tuning.server;

public class PassiveRequestQueue
{
  FIFO_Queue queue = new FIFO_Queue();

  public synchronized void acceptRequest(Request r)
  {
    queue.add(r);
    notify();
  }

  public synchronized Request releaseRequest()
  {
    for(;;)
    {
      if (queue.isEmpty())
        try {wait();} catch (InterruptedException e){}
      //Need to check again, in case the we were interrupted
      if (!queue.isEmpty())
        return (Request) queue.pop();
    }
  }
}