activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6435 - destination mbean query api, return the right count
Date Tue, 27 Sep 2016 10:54:17 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 63d62a71f -> e8ba0b011


https://issues.apache.org/jira/browse/AMQ-6435 - destination mbean query api, return the right
count


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

Branch: refs/heads/master
Commit: e8ba0b0119df071e809861b4e4a4632d089a5055
Parents: 63d62a7
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Tue Sep 27 12:53:49 2016 +0200
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Tue Sep 27 12:53:49 2016 +0200

----------------------------------------------------------------------
 .../activemq/broker/jmx/DestinationsViewFilter.java    | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/e8ba0b01/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java
index bd9a27f..84b87d9 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java
@@ -127,29 +127,28 @@ public class DestinationsViewFilter implements Serializable {
      */
     String filter(int page, int pageSize) throws IOException {
         ObjectMapper mapper = new ObjectMapper();
-        Map<ObjectName, DestinationView> filtered = getFilteredDestinations(page, pageSize);
+        destinations = Maps.filterValues(destinations, getPredicate());
+        Map<ObjectName, DestinationView> pagedDestinations = getPagedDestinations(page,
pageSize);
         Map<String, Object> result = new HashMap<String, Object>();
-        result.put("data", filtered);
+        result.put("data", pagedDestinations);
         result.put("count", destinations.size());
         StringWriter writer = new StringWriter();
         mapper.writeValue(writer, result);
         return writer.toString();
     }
 
-    Map<ObjectName, DestinationView> getFilteredDestinations(int page, int pageSize)
{
-        Map<ObjectName, DestinationView> filtered = Maps.filterValues(destinations,
getPredicate());
+    Map<ObjectName, DestinationView> getPagedDestinations(int page, int pageSize) {
         ImmutableMap.Builder<ObjectName, DestinationView> builder = ImmutableMap.builder();
         int start = (page - 1) * pageSize;
-        int end = Math.min(page * pageSize, filtered.size());
+        int end = Math.min(page * pageSize, destinations.size());
         int i = 0;
         for (Map.Entry<ObjectName, DestinationView> entry :
-                getOrdering().sortedCopy(filtered.entrySet())) {
+                getOrdering().sortedCopy(destinations.entrySet())) {
             if (i >= start && i < end) {
                 builder.put(entry.getKey(), entry.getValue());
             }
             i++;
         }
-
         return builder.build();
     }
 


Mime
View raw message