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:36:06 -07:00
parent ef295414b2
commit 9224f27ba3
3 changed files with 87 additions and 20 deletions

View File

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

View File

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

View File

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