Code example for BlockingQueue

Methods: remainingCapacity

     * @return list of messages that were deleted to create additional space. 
    public synchronized List<LogCatMessage> ensureSpace(int messageCount) {
        List<LogCatMessage> l = new ArrayList<LogCatMessage>(messageCount);
        while (mQ.remainingCapacity() < messageCount) {
        return l;
     * Returns the number of additional elements that this queue can 
     * ideally (in the absence of memory or resource constraints) 
     * accept without blocking. 
     * @return the remaining capacity 
    public synchronized int remainingCapacity() { 
        return mQ.remainingCapacity();