for(;;)
{
//if the queue is empty, just go back into the wait call
if (queue.isEmpty())
try {wait();} catch (InterruptedException e){}
//We might have been interrupted. If shutdown is true
//then return a null request to indicate the thread
//should finish
if (shutdown)
return null;
//Otherwise we need to check again if the queue
//is empty, just in case.
if (!queue.isEmpty())
return (Request) queue.pop();
}