Package org.apache.activemq.broker.region

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


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


        int delta = node.getMessageHardRef().getSize();
        synchronized (lock) {
            list.add(node);
            size += delta;
            while (size > maximumSize) {
                MessageReference evicted = (MessageReference) list.removeFirst();
                size -= evicted.getMessageHardRef().getSize();
            }
        }
    }
View Full Code Here

    public Message[] browse(ActiveMQDestination destination) {
        List result = new ArrayList();
        DestinationFilter filter=DestinationFilter.parseFilter(destination);
        synchronized(lock){
            for (Iterator i = list.iterator(); i.hasNext();){
                MessageReference ref = (MessageReference)i.next();
                Message msg;
                try{
                    msg=ref.getMessage();
                    if (filter.matches(msg.getDestination())){
                        result.add(msg);
                    }
                }catch(IOException e){
                   log.error("Failed to get Message from MessageReference: " + ref,e);
View Full Code Here

        return true;
    }

    public void recover(ConnectionContext context, Topic topic, Subscription sub) throws Exception {
        // Re-dispatch the last message seen.
        MessageReference node = lastImage;
        if( node != null ){
            MessageEvaluationContext msgContext = context.getMessageEvaluationContext();
            try {
                msgContext.setDestination(node.getRegionDestination().getActiveMQDestination());
                msgContext.setMessageReference(node);                       
                if (sub.matches(node, msgContext)) {
                    sub.add(node);
                }
            } finally {
View Full Code Here

    public MessageReference[] evictMessages(LinkedList messages) throws IOException {
        byte lowestPriority = Byte.MAX_VALUE;
        int pivot = 0;
        Iterator iter = messages.iterator();
        for (int i = 0; iter.hasNext(); i++) {
            MessageReference reference = (MessageReference) iter.next();
            byte priority = reference.getMessage().getPriority();
            if (priority < lowestPriority) {
                lowestPriority = priority;
                pivot = i;
            }
        }
View Full Code Here

        return true;
    }

    public void recover(ConnectionContext context, Topic topic, SubscriptionRecovery sub) throws Exception {
        // Re-dispatch the last message seen.
        MessageReference node = lastImage;
        if (node != null) {
            sub.addRecoveredMessage(context, node);
        }
    }
View Full Code Here

        if (messages[t] == null) {
            return;
        }
        // Keep dispatching until t hit's tail again.
        do {
            MessageReference node = messages[t];
            sub.addRecoveredMessage(context, node);
            t++;
            if (t >= messages.length) {
                t = 0;
            }
View Full Code Here

        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

        // 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

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.