347 new HashMap<String, Object>(attributesInfo.length); |
347 new HashMap<String, Object>(attributesInfo.length); |
348 AttributeList list = null; |
348 AttributeList list = null; |
349 |
349 |
350 try { |
350 try { |
351 list = mbean.getAttributes(attributesInfo); |
351 list = mbean.getAttributes(attributesInfo); |
352 }catch(Exception e) { |
352 } catch (Exception e) { |
|
353 if (JConsole.isDebug()) { |
|
354 System.err.println("Error calling getAttributes() on MBean \"" + |
|
355 mbean.getObjectName() + "\". JConsole will " + |
|
356 "try to get them individually calling " + |
|
357 "getAttribute() instead. Exception:"); |
|
358 e.printStackTrace(System.err); |
|
359 } |
353 list = new AttributeList(); |
360 list = new AttributeList(); |
354 //Can't load all attributes, do it one after each other. |
361 //Can't load all attributes, do it one after each other. |
355 for(int i = 0; i < attributesInfo.length; i++) { |
362 for(int i = 0; i < attributesInfo.length; i++) { |
356 String name = null; |
363 String name = null; |
357 try { |
364 try { |
358 name = attributesInfo[i].getName(); |
365 name = attributesInfo[i].getName(); |
359 Object value = |
366 Object value = |
360 mbean.getAttribute(name); |
367 mbean.getMBeanServerConnection().getAttribute(mbean.getObjectName(), name); |
361 list.add(new Attribute(name, value)); |
368 list.add(new Attribute(name, value)); |
362 }catch(Exception ex) { |
369 }catch(Exception ex) { |
363 if(attributesInfo[i].isReadable()) { |
370 if(attributesInfo[i].isReadable()) { |
364 unavailableAttributes.put(name, |
371 unavailableAttributes.put(name, |
365 Utils.getActualException(ex). |
372 Utils.getActualException(ex). |
395 // exception. |
402 // exception. |
396 // We must call it again to understand what |
403 // We must call it again to understand what |
397 // went wrong. |
404 // went wrong. |
398 try { |
405 try { |
399 Object v = |
406 Object v = |
400 mbean.getAttribute(attributeInfo. |
407 mbean.getMBeanServerConnection().getAttribute( |
401 getName()); |
408 mbean.getObjectName(), attributeInfo.getName()); |
402 //What happens if now it is ok? |
409 //What happens if now it is ok? |
403 // Be pragmatic, add it to readable... |
410 // Be pragmatic, add it to readable... |
404 attributes.put(attributeInfo.getName(), |
411 attributes.put(attributeInfo.getName(), |
405 v); |
412 v); |
406 }catch(Exception e) { |
413 }catch(Exception e) { |