Package org.apache.uima.aae.jmx.monitor
Class JmxMonitor
- java.lang.Object
-
- org.apache.uima.aae.jmx.monitor.JmxMonitor
-
- All Implemented Interfaces:
java.lang.Runnable
public class JmxMonitor extends java.lang.Object implements java.lang.RunnableCollects metrics from UIMA-AS Service MBeans at defined intervals and passes the metrics for formatting to the registeredJmxMonitorListener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFormatterListenerstatic java.lang.StringSamplingInterval
-
Constructor Summary
Constructors Constructor Description JmxMonitor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJmxMonitorListener(JmxMonitorListener listener)Registers customJmxMonitorListenerprotected ServiceMetrics[]collectStats(boolean initial, long uptime)voiddoStop()intgetMaxServiceNameLength()protected intgetServiceCount()voidinitialize(java.lang.String remoteServerURI, long samplingInterval)Connects to a remote JMX server identified by givenremoteServerURI.booleanisRunning()booleanisVerbose()static voidmain(java.lang.String[] args)voidnotifyListeners(long uptime, ServiceMetrics[] metrics)Passes metrics to all registeredJmxMonitorListenerobjectsvoidrun()Retrieves metrics from UIMA-AS MBeans at defined interval.voidsetVerbose()
-
-
-
Field Detail
-
SamplingInterval
public static final java.lang.String SamplingInterval
- See Also:
- Constant Field Values
-
FormatterListener
public static final java.lang.String FormatterListener
- See Also:
- Constant Field Values
-
-
Method Detail
-
addJmxMonitorListener
public void addJmxMonitorListener(JmxMonitorListener listener)
Registers customJmxMonitorListener- Parameters:
listener- - listener to receive metrics for formatting
-
notifyListeners
public void notifyListeners(long uptime, ServiceMetrics[] metrics)Passes metrics to all registeredJmxMonitorListenerobjects- Parameters:
uptime- - time when the metrics were collectedmetrics- - current metrics
-
isVerbose
public boolean isVerbose()
-
setVerbose
public void setVerbose()
-
getMaxServiceNameLength
public int getMaxServiceNameLength()
-
initialize
public void initialize(java.lang.String remoteServerURI, long samplingInterval) throws java.lang.ExceptionConnects to a remote JMX server identified by givenremoteServerURI. Creates proxies for all UIMA AS ServicePerformance MBeans found in the JMX server registry. If UIMA AS service MBean indicates a remote service, this method connects to a remote Broker and creates a proxy to an input queue for that service.- Parameters:
remoteServerURI-samplingInterval-- Throws:
java.lang.Exception
-
getServiceCount
protected int getServiceCount()
-
collectStats
protected ServiceMetrics[] collectStats(boolean initial, long uptime)
-
run
public void run()
Retrieves metrics from UIMA-AS MBeans at defined interval.- Specified by:
runin interfacejava.lang.Runnable
-
isRunning
public boolean isRunning()
-
doStop
public void doStop()
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-