public synchronized Object dequeue() throws EndOfQueueException {
        while (queue.isEmpty() && !closed) {
            try { wait(); } catch (InterruptedException x) {}
        }
        if (queue.isEmpty()) {
            throw new EndOfQueueException();
        }
        return queue.dequeue();
    }
Dequeue the next object from this queue. This method will block
until at least one object is available in the queue.

@return the next object from the queue
@throws EndOfQueueException if the queue is both empty and
closed
jrt/src/com/yahoo/jrt/ThreadQueue.java