Interface | Description |
---|---|
CounterMXBean |
Interface for MX Bean representing a particular
Counter . |
SimonManagerMXBean |
Interface of Simon management bean (MXBean) representing single point of access to a particular Simon
Manager . |
SimonSuperMXBean |
Interface with common methods for JMX beans for a single Simon that corresponds
to AbstractSimon in the core package.
|
StopwatchMXBean |
Interface for MX Bean representing a particular
Stopwatch . |
Class | Description |
---|---|
AbstractSimonMXBeanImpl |
Common functionality for JMX bean for a single Simon that corresponds to AbstractSimon in the core package.
|
CounterMXBeanImpl |
MX Bean representing a particular
Counter . |
CounterSample |
Value object for retrieving data from Counter Simon.
|
JmxRegisterCallback |
Callback that registers MXBeans for Simons after their creation.
|
JmxReporter |
Utility class for registering JMX beans that can be used to access Simon manager and Simons.
|
SimonInfo |
Value object for retrieving Simon name and type info via Simon MXBean (
SimonManagerMXBean ). |
SimonManagerMXBeanImpl |
Simon MXBean implementation.
|
StopwatchMXBeanImpl |
MX Bean representing a particular
Stopwatch . |
StopwatchSample |
Value object for retrieving data from Stopwatch Simon.
|
JmxRegisterCallback
.SimonManagerMXBean
) implements jmx support for core functionality,
it means firstly management of java Simons during runtime and secondly, very requested,
way how to get gathered data by Simons out of application (jvm) for additional processing.
From management point of view it provides similar functionality like Manager
,
but this functionality is accessible remotely. Management features are:
Technically, there are two methods, each for one Simon
type, SimonManagerMXBean.getCounterSample(String)
for retrieving data from Counter Simon
and SimonManagerMXBean.getStopwatchSample(String)
for retrieving data from Stopwatch Simon. Returned
value object is basically Sample object for each type of Simon as is known from core package. Each
sample has all needed access methods of its Simon. Parameter for retrieving methods is Simon hierarchical
name. To know all existing Simons and its type, use SimonManagerMXBean.getSimonInfos()
.
Both MBean needs to be registered first. Snippet bellow registers the Simon MBean:
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { ObjectName name = new ObjectName("org.javasimon.jmx.example:type=Simon"); if (mbs.isRegistered(name)) { mbs.unregisterMBean(name); } SimonManagerMXBean simon = new SimonManagerMXBeanImpl(SimonManager.manager()); mbs.registerMBean(simon, name); System.out.println("SimonManagerMXBean registered under name: "+name); } catch (JMException e) { System.out.println("SimonManagerMXBean registration failed!\n"+e); }Following code then unregisters the MBean.
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { ObjectName name = new ObjectName("org.javasimon.jmx.example:type=Simon"); if (mbs.isRegistered(name)) { mbs.unregisterMBean(name); } System.out.println("SimonManagerMXBean was unregistered"); } catch (JMException e) { System.out.println("SimonManagerMXBean unregistration failed!\n"+e); }Java Simon doesn't provide any automatic mechanism or util functions to register or unregister Simon MBean because there are simply too many things which could be customized. It is programmer's responsibility to properly register and later unregister MBean from MBean server.
Copyright © 2019. All rights reserved.