Package org.apache.activemq.broker.region

Examples of org.apache.activemq.broker.region.MessageReference


       }
       return currentCursor != null ? currentCursor.hasNext() : false;
    }

    public synchronized MessageReference next() {
        MessageReference result = currentCursor != null ? currentCursor.next() : null;
        return result;
    }
View Full Code Here


   
    @Override
    public List<MessageReference> remove(ConnectionContext context, Destination destination) throws Exception {
        List<MessageReference> rc = new ArrayList<MessageReference>();
        for (Iterator<MessageReference> iterator = list.iterator(); iterator.hasNext();) {
            MessageReference r = iterator.next();
            if( r.getRegionDestination()==destination ) {
                r.decrementReferenceCount();
                rc.add(r);
                iterator.remove();
            }
        }
        return rc ;       
View Full Code Here

    public synchronized boolean isEmpty() {
        if (list.isEmpty()) {
            return true;
        } else {
            for (Iterator<MessageReference> iterator = list.iterator(); iterator.hasNext();) {
                MessageReference node = iterator.next();
                if (node== QueueMessageReference.NULL_MESSAGE){
                  continue;
                }
                if (!node.isDropped()) {
                    return false;
                }
                // We can remove dropped references.
                iterator.remove();
            }
View Full Code Here

        list.clear();
    }

    public synchronized void remove(MessageReference node) {
        for (Iterator<MessageReference> i = list.iterator(); i.hasNext();) {
            MessageReference ref = i.next();
            if (node.getMessageId().equals(ref.getMessageId())) {
                ref.decrementReferenceCount();
                i.remove();
                break;
            }
        }
    }
View Full Code Here

    public synchronized boolean isEmpty() {
        if(memoryList.isEmpty() && isDiskListEmpty()){
            return true;
        }
        for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();) {
            MessageReference node = iterator.next();
            if (node== QueueMessageReference.NULL_MESSAGE){
                continue;
            }
            if (!node.isDropped()) {
                return false;
            }
            // We can remove dropped references.
            iterator.remove();
        }
View Full Code Here

    protected synchronized void expireOldMessages() {
        if (!memoryList.isEmpty()) {
            LinkedList<MessageReference> tmpList = new LinkedList<MessageReference>(this.memoryList);
            this.memoryList = new LinkedList<MessageReference>();
            while (!tmpList.isEmpty()) {
                MessageReference node = tmpList.removeFirst();
                if (node.isExpired()) {
                    discard(node);
                }else {
                    memoryList.add(node);
                }              
            }
View Full Code Here

    protected synchronized void flushToDisk() {
      
        if (!memoryList.isEmpty()) {
            while (!memoryList.isEmpty()) {
                MessageReference node = memoryList.removeFirst();
                node.decrementReferenceCount();
                getDiskList().addLast(node);
            }
            memoryList.clear();
        }
    }
View Full Code Here

        // Re-dispatch the messages from the buffer.
        ArrayList<TimestampWrapper> copy = new ArrayList<TimestampWrapper>(buffer);
        if (!copy.isEmpty()) {
            for (Iterator<TimestampWrapper> iter = copy.iterator(); iter.hasNext();) {
                TimestampWrapper timestampWrapper = iter.next();
                MessageReference message = timestampWrapper.message;
                sub.addRecoveredMessage(context, message);
            }
        }
    }
View Full Code Here

        List<Message> result = new ArrayList<Message>();
        ArrayList<TimestampWrapper> copy = new ArrayList<TimestampWrapper>(buffer);
        DestinationFilter filter = DestinationFilter.parseFilter(destination);
        for (Iterator<TimestampWrapper> iter = copy.iterator(); iter.hasNext();) {
            TimestampWrapper timestampWrapper = iter.next();
            MessageReference ref = timestampWrapper.message;
            Message message = ref.getMessage();
            if (filter.matches(message.getDestination())) {
                result.add(message);
            }
        }
        return result.toArray(new Message[result.size()]);
View Full Code Here

        }
        return result;
    }

    public synchronized MessageReference next() {
        MessageReference result = currentCursor != null ? currentCursor.next() : null;
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.MessageReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.