activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject [01/13] git commit: Fixed AMQ-5160, fixed browse() to include messages from wrapped policy
Date Mon, 26 May 2014 09:07:28 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk ba519d8bd -> 6c859676b


Fixed AMQ-5160, fixed browse() to include messages from wrapped policy


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/5576dc5d
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/5576dc5d
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/5576dc5d

Branch: refs/heads/trunk
Commit: 5576dc5d74e8ccb284dda19d60872a1efb03fcd0
Parents: a581d01
Author: Dhiraj Bokde <dhirajsb@yahoo.com>
Authored: Mon May 12 19:51:21 2014 -0700
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Mon May 26 11:07:18 2014 +0200

----------------------------------------------------------------------
 .../RetainedMessageSubscriptionRecoveryPolicy.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/5576dc5d/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/RetainedMessageSubscriptionRecoveryPolicy.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/RetainedMessageSubscriptionRecoveryPolicy.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/RetainedMessageSubscriptionRecoveryPolicy.java
index ba2d1a1..fb0313f 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/RetainedMessageSubscriptionRecoveryPolicy.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/RetainedMessageSubscriptionRecoveryPolicy.java
@@ -17,6 +17,7 @@
 package org.apache.activemq.broker.region.policy;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.activemq.broker.Broker;
@@ -83,14 +84,23 @@ public class RetainedMessageSubscriptionRecoveryPolicy implements SubscriptionRe
     }
 
     public Message[] browse(ActiveMQDestination destination) throws Exception {
-        List<Message> result = new ArrayList<Message>();
+        final List<Message> result = new ArrayList<Message>();
         if (retainedMessage != null) {
             DestinationFilter filter = DestinationFilter.parseFilter(destination);
             if (filter.matches(retainedMessage.getMessage().getDestination())) {
                 result.add(retainedMessage.getMessage());
             }
         }
-        return result.toArray(new Message[result.size()]);
+        Message[] messages = result.toArray(new Message[result.size()]);
+        if (wrapped != null) {
+            final Message[] wrappedMessages = wrapped.browse(destination);
+            if (wrappedMessages != null && wrappedMessages.length > 0) {
+                final int origLen = messages.length;
+                messages = Arrays.copyOf(messages, origLen + wrappedMessages.length);
+                System.arraycopy(wrappedMessages, 0, messages, origLen, wrappedMessages.length);
+            }
+        }
+        return messages;
     }
 
     public SubscriptionRecoveryPolicy copy() {


Mime
View raw message