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


        if(messages[t]==null)
            return;
        // Keep dispatching until t hit's tail again.
        MessageEvaluationContext msgContext=context.getMessageEvaluationContext();
        do{
            MessageReference node=messages[t];
            try{
                msgContext.setDestination(node.getRegionDestination().getActiveMQDestination());
                msgContext.setMessageReference(node);
                if(sub.matches(node,msgContext)){
                    sub.add(node);
                }
            }finally{
View Full Code Here

        int t=tail;
        if(messages[t]==null)
            t=0;
        if(messages[t]!=null){
            do{
                MessageReference ref=messages[t];
                Message message=ref.getMessage();
                if(filter.matches(message.getDestination())){
                    result.add(message);
                }
                t++;
                if(t>=messages.length)
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

    @Override
    public synchronized LinkedList<MessageReference> pageInList(int maxItems) {
        LinkedList<MessageReference> result = new LinkedList<MessageReference>();
        int count = 0;
        for (Iterator<MessageReference> i = memoryList.iterator(); i.hasNext() && count < maxItems;) {
            MessageReference ref = i.next();
            ref.incrementReferenceCount();
            result.add(ref);
            count++;
        }
        if (count < maxItems && !isDiskListEmpty()) {
            for (Iterator<MessageReference> i = new DiskIterator(); i.hasNext() && count < maxItems;) {
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();
                ByteSequence bs;
                try {
                    bs = getByteSequence(node.getMessage());
                    getDiskList().addLast(node.getMessageId().toString(), bs);
                } catch (IOException e) {
                    LOG.error("Failed to write to disk list", e);
                    throw new RuntimeException(e);
                }
View Full Code Here

        return result;
    }

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

        if (!copy.isEmpty()) {
            MessageEvaluationContext msgContext = context.getMessageEvaluationContext();
            try {
                for (Iterator iter = copy.iterator(); iter.hasNext();) {
                    TimestampWrapper timestampWrapper = (TimestampWrapper) iter.next();
                    MessageReference message = timestampWrapper.message;
                    msgContext.setDestination(message.getRegionDestination().getActiveMQDestination());
                    msgContext.setMessageReference(message);
                    if (sub.matches(message, msgContext)) {
                        sub.add(timestampWrapper.message);
                    }
                }
View Full Code Here

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