de.is24.util.monitoring.jmx
Class InApplicationMonitorJMXConnector
java.lang.Object
de.is24.util.monitoring.jmx.InApplicationMonitorJMXConnector
- All Implemented Interfaces:
- ReportableObserver, DynamicMBean
public final class InApplicationMonitorJMXConnector
- extends Object
- implements DynamicMBean, ReportableObserver
This class publishes values registered at the Core Plugin as JMX MBeans and exposes
some management operations of InApplicationMonitor.
Simple values (Counter, Version, StateValue) are published directly via this class
as dynamic MBean, complex types are published using an own MBean for each Reportable.
|
Method Summary |
void |
activate()
|
void |
addNewReportable(Reportable reportable)
This method is called for each reportable that is registered on the InApplicationMonitor. |
private void |
addStateValuesToGraphite(String host,
Integer port,
String appName)
|
private void |
addStatsdPlugin(String host,
Integer port,
String appName,
Double sampleRate)
|
private ObjectName |
createBeanName(String name,
String type)
|
void |
deactivate()
|
String |
dumpHistogramLikeValueAnalysis(String base)
|
String |
dumpStringWriter()
|
Object |
getAttribute(String attribute)
|
AttributeList |
getAttributes(String[] attributes)
|
MBeanInfo |
getMBeanInfo()
|
List<String> |
getRegisteredPluginKeys()
|
private Object |
getValueForReportable(String attribute)
|
Object |
invoke(String actionName,
Object[] params,
String[] signature)
|
Boolean |
isMonitorActive()
|
private void |
registerJMXStuff()
registers the InApplicationMonitor as JMX MBean on the running JMX
server - if no JMX server is running, one is started automagically. |
protected void |
registerMBeanOnJMX(Object object,
String name,
String type)
|
void |
removeAllReportables()
|
void |
setAttribute(Attribute attribute)
|
AttributeList |
setAttributes(AttributeList attributes)
|
void |
shutdown()
|
protected void |
unregisterMBeanOnJMX(Object object,
String name,
String type)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DUMP_STRING_WRITER
private static final String DUMP_STRING_WRITER
- See Also:
- Constant Field Values
DUMP_HISTOGRAM_LIKE_VALUE_ANALYSIS
private static final String DUMP_HISTOGRAM_LIKE_VALUE_ANALYSIS
- See Also:
- Constant Field Values
ACTIVATE
private static final String ACTIVATE
- See Also:
- Constant Field Values
DEACTIVATE
private static final String DEACTIVATE
- See Also:
- Constant Field Values
IS_MONITOR_ACTIVE
private static final String IS_MONITOR_ACTIVE
- See Also:
- Constant Field Values
GET_REGISTERED_PLUGIN_KEYS
private static final String GET_REGISTERED_PLUGIN_KEYS
- See Also:
- Constant Field Values
REMOVE_ALL_PLUGINS
private static final String REMOVE_ALL_PLUGINS
- See Also:
- Constant Field Values
ADD_STATSD_PLUGIN
private static final String ADD_STATSD_PLUGIN
- See Also:
- Constant Field Values
ADD_STATE_VALUES_TO_GRAPHITE
private static final String ADD_STATE_VALUES_TO_GRAPHITE
- See Also:
- Constant Field Values
LOG
private static final org.apache.log4j.Logger LOG
instance
private static InApplicationMonitorJMXConnector instance
reportables
private final Map<String,Reportable> reportables
beanServer
private MBeanServer beanServer
jmxPrefix
private String jmxPrefix
corePlugin
private final CorePlugin corePlugin
InApplicationMonitorJMXConnector
public InApplicationMonitorJMXConnector(JmxAppMon4JNamingStrategy namingStrategy)
InApplicationMonitorJMXConnector
public InApplicationMonitorJMXConnector(String jmxPrefix)
InApplicationMonitorJMXConnector
public InApplicationMonitorJMXConnector(CorePlugin corePlugin,
String jmxPrefix)
shutdown
public void shutdown()
addNewReportable
public void addNewReportable(Reportable reportable)
- This method is called for each reportable that is registered on the InApplicationMonitor.
Basically, it checks if the JMX implementation is interested in the reportable and adds
it to the "reportables" map which is the base for both getAttribute(s) and getMBeanInfo().
- Specified by:
addNewReportable in interface ReportableObserver
removeAllReportables
public void removeAllReportables()
registerJMXStuff
private void registerJMXStuff()
- registers the InApplicationMonitor as JMX MBean on the running JMX
server - if no JMX server is running, one is started automagically.
registerMBeanOnJMX
protected void registerMBeanOnJMX(Object object,
String name,
String type)
throws InstanceAlreadyExistsException,
MBeanRegistrationException,
NotCompliantMBeanException,
MalformedObjectNameException
- Throws:
InstanceAlreadyExistsException
MBeanRegistrationException
NotCompliantMBeanException
MalformedObjectNameException
unregisterMBeanOnJMX
protected void unregisterMBeanOnJMX(Object object,
String name,
String type)
throws InstanceNotFoundException,
MBeanRegistrationException,
MalformedObjectNameException
- Throws:
InstanceNotFoundException
MBeanRegistrationException
MalformedObjectNameException
createBeanName
private ObjectName createBeanName(String name,
String type)
throws MalformedObjectNameException
- Throws:
MalformedObjectNameException
getMBeanInfo
public MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfo in interface DynamicMBean
getValueForReportable
private Object getValueForReportable(String attribute)
getAttribute
public Object getAttribute(String attribute)
throws AttributeNotFoundException,
MBeanException,
ReflectionException
- Specified by:
getAttribute in interface DynamicMBean
- Throws:
AttributeNotFoundException
MBeanException
ReflectionException
getAttributes
public AttributeList getAttributes(String[] attributes)
- Specified by:
getAttributes in interface DynamicMBean
setAttribute
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException
- Specified by:
setAttribute in interface DynamicMBean
- Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
setAttributes
public AttributeList setAttributes(AttributeList attributes)
- Specified by:
setAttributes in interface DynamicMBean
invoke
public Object invoke(String actionName,
Object[] params,
String[] signature)
throws MBeanException,
ReflectionException
- Specified by:
invoke in interface DynamicMBean
- Throws:
MBeanException
ReflectionException
addStatsdPlugin
private void addStatsdPlugin(String host,
Integer port,
String appName,
Double sampleRate)
addStateValuesToGraphite
private void addStateValuesToGraphite(String host,
Integer port,
String appName)
dumpStringWriter
public String dumpStringWriter()
dumpHistogramLikeValueAnalysis
public String dumpHistogramLikeValueAnalysis(String base)
activate
public void activate()
deactivate
public void deactivate()
isMonitorActive
public Boolean isMonitorActive()
getRegisteredPluginKeys
public List<String> getRegisteredPluginKeys()
Copyright © 2013 Immobilien Scout GmbH. All Rights Reserved.