Code example for BlockingQueue

Methods: size, take

0
            String ndc = getPreferredNDC();
            if (ndc != null) {
                Logger.pushNDC(ndc);
            } 
            try { 
                Logger.trace("MessageProcessor working: " + queue.size() + " messages in the queue");
                Message msg = queue.take();
                Logger.trace("Next message: " + msg);
                AbstractComponent.this.processMessage(msg);
                return true; 
            } 
            finally { 
                if (ndc != null) {
                    Logger.popNDC(); 
                } 
            } 
        } 
    } 
 
 
    private class MessageListener implements ConnectionListener {