Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. try {
  2. this.jmxConnector = JMXConnectorFactory.connect(serviceURL, auth);
  3. if (this.jmxConnector != null) {
  4. MBeanServerConnection mbs = this.jmxConnector.getMBeanServerConnection();
  5. if (mbs != null) {
  6. this.mbs = mbs;
  7. }
  8. }
  9. } catch (IOException e) {
  10. connected = false;
  11. }
  12.  
  13. private Map<String, Object> getAttributesForMBean(ObjectName objectName, List<String> attributeNames) {
  14.  
  15. HashMap<String, Object> attributeMap = new HashMap<String, Object>();
  16. for (String attributeName : attributeNames) {
  17. Object attributeValue = null;
  18. if (this.hasAttribute(objectName, attributeName)) {
  19. try {
  20. attributeValue = this.mbs.getAttribute(objectName, attributeName);
  21. } catch (Exception e) {
  22. logger.warn("In getAttributes(), for " + objectName + ": " , e);
  23. }
  24. }
  25. attributeMap.put(attributeName, attributeValue);
  26. }
  27. return attributeMap;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement