catch(IllegalMonitorStateException ex) { throw ex; }
    public Object remove() throws QueueClosedException {        Object retval=null;        /*lock the queue*/        synchronized(mutex) {            /*wait as long as the queue is empty*/            while(l.size() == 0) {                if(closed)                    throw new QueueClosedException();                try {                    mutex.wait();                }                catch(IllegalMonitorStateException ex) {                    throw ex;                }                catch(InterruptedException ex) {                }            }            if(closed)                throw new QueueClosedException();            /*remove the head from the queue*/	    try {		retval=l.removeFirst();		if(l.size() == 1 && l.getFirst().equals(endMarker))		    closed=true;	    }	    catch(NoSuchElementException ex) {		if(log.isErrorEnabled()) log.error("retval == null, size()=" + l.size());		return null;			    }	    // we ran into an Endmarker, which means that the queue was closed before	    // through close(true)	    if(retval == endMarker) {		close(false); // mark queue as closed		throw new QueueClosedException();	    }        }        /*return the object, should be never null*/        return retval;    }