List of usage examples for javax.management AttributeList addAll
@Override public boolean addAll(Collection<?> c)
From source file:org.wso2.carbon.as.monitoring.collector.jmx.clients.MBeanClient.java
/** * Read the possible attribute values from the MBean * * @return List of Result objects//from w ww.java2 s. co m */ public List<Result> readPossibleAttributeValues() throws MalformedObjectNameException { ObjectName name = new ObjectName(getObjectNameQuery()); Set<ObjectInstance> instances = server.queryMBeans(name, null); List<Result> results = new ArrayList<Result>(); for (ObjectInstance instance : instances) { ObjectName objectName = instance.getObjectName(); AttributeList attributes = null; try { attributes = server.getAttributes(objectName, getAttributeNames()); } catch (InstanceNotFoundException ignored) { // Here we put best-effort to grab any attributes. // Missing objects are ignored. We need whatever possible. if (LOG.isDebugEnabled()) { LOG.debug(objectName + " MBean not found : " + ignored.getMessage(), ignored); } } catch (ReflectionException ignored) { // Here we put best-effort to grab any attributes. // erroneous attributes are ignored. We need whatever possible. if (LOG.isDebugEnabled()) { LOG.debug("Exception occurred while reading the attributes from " + objectName, ignored); } } if (attributes != null) { attributes.addAll(getPropertiesFromKey(objectName)); } Result result = new Result(getCorrelationKey(objectName), attributes); results.add(result); } return results; }