Package fish.payara.jmx.monitoring
Class JMXMonitoringJob
- java.lang.Object
-
- fish.payara.jmx.monitoring.JMXMonitoringJob
-
public class JMXMonitoringJob extends Object
Class which gathers and returns monitoring information for a single MBean and a specified list of its attributes.- Author:
- savage
-
-
Constructor Summary
Constructors Constructor Description JMXMonitoringJob(ObjectName mBean, List<String> attributes)
Constructor for the JMXMonitoringJob class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(String attribute)
Adds an attribute to be monitored to the job.List<String>
getAttributes()
Returns the list of attributes being monitored.ObjectName
getMBean()
Returns the MBean monitored by the job.String
getMonitoringInfo(MBeanServer server)
Builds a String from the JMXMonitoringJob's MBean.
-
-
-
Constructor Detail
-
JMXMonitoringJob
public JMXMonitoringJob(ObjectName mBean, List<String> attributes) throws MalformedObjectNameException
Constructor for the JMXMonitoringJob class.- Parameters:
mBean
- MBean containing the attributes to be monitored.attributes
- Attribute names to be monitored.- Throws:
MalformedObjectNameException
-
-
Method Detail
-
getMonitoringInfo
public String getMonitoringInfo(MBeanServer server)
Builds a String from the JMXMonitoringJob's MBean. Loops through the attributes being monitored. For each attribute gets the object from the MBeanServer representing it. Gets the key-value pair of the attribute as a string and appends it.- Parameters:
server
- MBeanServer to get attributes values from.- Returns:
- Returns a monitoringString which contains key-value metrics.
-
getMBean
public ObjectName getMBean()
Returns the MBean monitored by the job.- Returns:
- The MBean monitored by the job.
-
getAttributes
public List<String> getAttributes()
Returns the list of attributes being monitored.- Returns:
- The attributes being monitored.
-
addAttribute
public void addAttribute(String attribute)
Adds an attribute to be monitored to the job. Will not add an attribute already being monitored.- Parameters:
attribute
- Name of attribute to be monitored.
-
-