Пример #1
0
 private AttributeList getAttributes(ObjectName objName, String[] attrNames)
     throws InstanceNotFoundException, ReflectionException, IOException {
   final NameValueMap values =
       getCachedAttributes(objName, new TreeSet<String>(Arrays.asList(attrNames)));
   final AttributeList list = new AttributeList();
   for (String attrName : attrNames) {
     final Object value = values.get(attrName);
     if (value != null || values.containsKey(attrName)) {
       list.add(new Attribute(attrName, value));
     }
   }
   return list;
 }
Пример #2
0
 private Object getAttribute(ObjectName objName, String attrName)
     throws MBeanException, InstanceNotFoundException, AttributeNotFoundException,
         ReflectionException, IOException {
   final NameValueMap values = getCachedAttributes(objName, Collections.singleton(attrName));
   Object value = values.get(attrName);
   if (value != null || values.containsKey(attrName)) {
     return value;
   }
   // Not in cache, presumably because it was omitted from the
   // getAttributes result because of an exception.  Following
   // call will probably provoke the same exception.
   return conn.getAttribute(objName, attrName);
 }