AMQ-6175 - Web console needs to only obtain lists of MBeans that are not

suppressed.
This commit is contained in:
Jeff Genender 2016-02-18 14:25:30 -07:00
parent bbb17da52f
commit 49974279a7
3 changed files with 87 additions and 20 deletions

View File

@ -280,77 +280,77 @@ public class BrokerView implements BrokerViewMBean {
@Override
public ObjectName[] getTopics() {
return safeGetBroker().getTopics();
return safeGetBroker().getTopicsNonSuppressed();
}
@Override
public ObjectName[] getQueues() {
return safeGetBroker().getQueues();
return safeGetBroker().getQueuesNonSuppressed();
}
@Override
public ObjectName[] getTemporaryTopics() {
return safeGetBroker().getTemporaryTopics();
return safeGetBroker().getTemporaryTopicsNonSuppressed();
}
@Override
public ObjectName[] getTemporaryQueues() {
return safeGetBroker().getTemporaryQueues();
return safeGetBroker().getTemporaryQueuesNonSuppressed();
}
@Override
public ObjectName[] getTopicSubscribers() {
return safeGetBroker().getTopicSubscribers();
return safeGetBroker().getTopicSubscribersNonSuppressed();
}
@Override
public ObjectName[] getDurableTopicSubscribers() {
return safeGetBroker().getDurableTopicSubscribers();
return safeGetBroker().getDurableTopicSubscribersNonSuppressed();
}
@Override
public ObjectName[] getQueueSubscribers() {
return safeGetBroker().getQueueSubscribers();
return safeGetBroker().getQueueSubscribersNonSuppressed();
}
@Override
public ObjectName[] getTemporaryTopicSubscribers() {
return safeGetBroker().getTemporaryTopicSubscribers();
return safeGetBroker().getTemporaryTopicSubscribersNonSuppressed();
}
@Override
public ObjectName[] getTemporaryQueueSubscribers() {
return safeGetBroker().getTemporaryQueueSubscribers();
return safeGetBroker().getTemporaryQueueSubscribersNonSuppressed();
}
@Override
public ObjectName[] getInactiveDurableTopicSubscribers() {
return safeGetBroker().getInactiveDurableTopicSubscribers();
return safeGetBroker().getInactiveDurableTopicSubscribersNonSuppressed();
}
@Override
public ObjectName[] getTopicProducers() {
return safeGetBroker().getTopicProducers();
return safeGetBroker().getTopicProducersNonSuppressed();
}
@Override
public ObjectName[] getQueueProducers() {
return safeGetBroker().getQueueProducers();
return safeGetBroker().getQueueProducersNonSuppressed();
}
@Override
public ObjectName[] getTemporaryTopicProducers() {
return safeGetBroker().getTemporaryTopicProducers();
return safeGetBroker().getTemporaryTopicProducersNonSuppressed();
}
@Override
public ObjectName[] getTemporaryQueueProducers() {
return safeGetBroker().getTemporaryQueueProducers();
return safeGetBroker().getTemporaryQueueProducersNonSuppressed();
}
@Override
public ObjectName[] getDynamicDestinationProducers() {
return safeGetBroker().getDynamicDestinationProducers();
return safeGetBroker().getDynamicDestinationProducersNonSuppressed();
}
@Override

View File

@ -17,11 +17,8 @@
package org.apache.activemq.broker.jmx;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutorService;
@ -607,81 +604,151 @@ public class ManagedRegionBroker extends RegionBroker {
return destination;
}
private ObjectName[] onlyNonSuppressed (Set<ObjectName> set){
List<ObjectName> nonSuppressed = new ArrayList<ObjectName>();
for(ObjectName key : set){
if (managementContext.isAllowedToRegister(key)){
nonSuppressed.add(key);
}
}
return nonSuppressed.toArray(new ObjectName[nonSuppressed.size()]);
}
protected ObjectName[] getTopics() {
Set<ObjectName> set = topics.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTopicsNonSuppressed() {
return onlyNonSuppressed(topics.keySet());
}
protected ObjectName[] getQueues() {
Set<ObjectName> set = queues.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getQueuesNonSuppressed() {
return onlyNonSuppressed(queues.keySet());
}
protected ObjectName[] getTemporaryTopics() {
Set<ObjectName> set = temporaryTopics.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTemporaryTopicsNonSuppressed() {
return onlyNonSuppressed(temporaryTopics.keySet());
}
protected ObjectName[] getTemporaryQueues() {
Set<ObjectName> set = temporaryQueues.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTemporaryQueuesNonSuppressed() {
return onlyNonSuppressed(temporaryQueues.keySet());
}
protected ObjectName[] getTopicSubscribers() {
Set<ObjectName> set = topicSubscribers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTopicSubscribersNonSuppressed() {
return onlyNonSuppressed(topicSubscribers.keySet());
}
protected ObjectName[] getDurableTopicSubscribers() {
Set<ObjectName> set = durableTopicSubscribers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getDurableTopicSubscribersNonSuppressed() {
return onlyNonSuppressed(durableTopicSubscribers.keySet());
}
protected ObjectName[] getQueueSubscribers() {
Set<ObjectName> set = queueSubscribers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getQueueSubscribersNonSuppressed() {
return onlyNonSuppressed(queueSubscribers.keySet());
}
protected ObjectName[] getTemporaryTopicSubscribers() {
Set<ObjectName> set = temporaryTopicSubscribers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTemporaryTopicSubscribersNonSuppressed() {
return onlyNonSuppressed(temporaryTopicSubscribers.keySet());
}
protected ObjectName[] getTemporaryQueueSubscribers() {
Set<ObjectName> set = temporaryQueueSubscribers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTemporaryQueueSubscribersNonSuppressed() {
return onlyNonSuppressed(temporaryQueueSubscribers.keySet());
}
protected ObjectName[] getInactiveDurableTopicSubscribers() {
Set<ObjectName> set = inactiveDurableTopicSubscribers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getInactiveDurableTopicSubscribersNonSuppressed() {
return onlyNonSuppressed(inactiveDurableTopicSubscribers.keySet());
}
protected ObjectName[] getTopicProducers() {
Set<ObjectName> set = topicProducers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTopicProducersNonSuppressed() {
return onlyNonSuppressed(topicProducers.keySet());
}
protected ObjectName[] getQueueProducers() {
Set<ObjectName> set = queueProducers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getQueueProducersNonSuppressed() {
return onlyNonSuppressed(queueProducers.keySet());
}
protected ObjectName[] getTemporaryTopicProducers() {
Set<ObjectName> set = temporaryTopicProducers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTemporaryTopicProducersNonSuppressed() {
return onlyNonSuppressed(temporaryTopicProducers.keySet());
}
protected ObjectName[] getTemporaryQueueProducers() {
Set<ObjectName> set = temporaryQueueProducers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getTemporaryQueueProducersNonSuppressed() {
return onlyNonSuppressed(temporaryQueueProducers.keySet());
}
protected ObjectName[] getDynamicDestinationProducers() {
Set<ObjectName> set = dynamicDestinationProducers.keySet();
return set.toArray(new ObjectName[set.size()]);
}
protected ObjectName[] getDynamicDestinationProducersNonSuppressed() {
return onlyNonSuppressed(dynamicDestinationProducers.keySet());
}
public Broker getContextBroker() {
return contextBroker;
}

View File

@ -411,7 +411,7 @@ public class ManagementContext implements Service {
return result;
}
private boolean isAllowedToRegister(ObjectName name) {
protected boolean isAllowedToRegister(ObjectName name) {
boolean result = true;
if (suppressMBean != null && suppressMBeanList != null) {
for (ObjectName attr : suppressMBeanList) {