Package org.jboss.byteman.sample.helper
Class JMXHelper
- java.lang.Object
-
- org.jboss.byteman.rule.helper.Helper
-
- org.jboss.byteman.sample.helper.JMXHelper
-
- All Implemented Interfaces:
DynamicMBean
public class JMXHelper extends Helper implements DynamicMBean
A variant of PeriodicHelper which publishes its stats via JMX
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_PERIODthe default period which the helper will wait for between calls to periodicUpdate in milliseconds.static StringDEFAULT_RMI_HOSTdefault value for the rmi server host address used by the JMX onnector server used only if an rmi server is required for the JMXConnectorstatic intDEFAULT_RMI_PORTdefault value for the rmi server port used by the JMX connector server used only if an rmi server is required for the JMXConnectorstatic intDEFAULT_SAMPLE_SET_SIZEdefault number of samples we are willing to store in order to maintain a running count of all previousstatic StringJMX_URLJMX Url pattern for use when creating the connector serverstatic StringSYSPROP_MBEAN_SERVERThis is a system property whose value will determine which MBean Server the MBeans should be registered in.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidactivated()helper activation method which creates a periodic helper thread to perform periodic calls to the trigger method.static voiddeactivated()helper deactivation method which shuts down the periodic helper thread.ObjectgetAttribute(String attribute)AttributeListgetAttributes(String[] attributes)MBeanInfogetMBeanInfo()ObjectgetValue(int idx)getter for counter values used by MBean codeObjectinvoke(String actionName, Object[] params, String[] signature)voidsetAttribute(Attribute attribute)AttributeListsetAttributes(AttributeList attributes)-
Methods inherited from class org.jboss.byteman.rule.helper.Helper
addCountDown, callerCheck, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, clear, clearLinks, clearLinks, closeTrace, countDown, createCountDown, createCounter, createCounter, createJoin, createLinkMap, createRendezvous, createRendezvous, createTimer, debug, decrementCounter, delay, deleteCounter, deleteLinkMap, deleteRendezvous, deleteTimer, err, errTraceException, flag, flagged, formatAllStacks, formatAllStacks, formatAllStacks, formatAllStacks, formatStack, formatStack, formatStack, formatStack, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackRange, formatThreadStack, formatThreadStack, formatThreadStack, formatThreadStack, getCountDown, getElapsedTimeFromTimer, getObjectSize, getRendezvous, getStack, incrementCounter, incrementCounter, installed, isCountDown, isJoin, isRendezvous, joinEnlist, joinWait, joinWait, killJVM, killJVM, killThread, link, link, linked, linked, linkNames, linkNames, linkValues, linkValues, matchIndex, noisy, noisyTraceException, openTrace, openTrace, out, outTraceException, printFrame, printlnFrame, readCounter, readCounter, rendezvous, rendezvous, resetTimer, setTriggering, signalKill, signalKill, signalThrow, signalThrow, signalWake, signalWake, toString, trace, trace, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceClose, traceln, traceln, traceOpen, traceOpen, traceStack, traceStack, traceStack, traceStack, traceStack, traceStack, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackRange, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, triggerIndex, uninstalled, unlink, unlink, verbose, verboseTraceException, waitFor, waitFor, waiting
-
-
-
-
Field Detail
-
SYSPROP_MBEAN_SERVER
public static final String SYSPROP_MBEAN_SERVER
This is a system property whose value will determine which MBean Server the MBeans should be registered in. If the system property is not defined, the default will be the platform MBeanServer itself. If this system property is set, it will be assumed to be a default domain name of an existing MBeanServer. The existing MBeanServer with that default domain name will be used to house the MBeans. If there is no existing MBeanServer with the given default domain name, one will be created. Note that if this sysprop has the special value "*platform*", then the platform MBeanServer will be used (i.e. it will be as if this sysprop was not set).- See Also:
- Constant Field Values
-
DEFAULT_PERIOD
public static final long DEFAULT_PERIOD
the default period which the helper will wait for between calls to periodicUpdate in milliseconds. this can be redefined either by overriding defaultPeriod- See Also:
- Constant Field Values
-
DEFAULT_SAMPLE_SET_SIZE
public static final int DEFAULT_SAMPLE_SET_SIZE
default number of samples we are willing to store in order to maintain a running count of all previous- See Also:
- Constant Field Values
-
DEFAULT_RMI_HOST
public static final String DEFAULT_RMI_HOST
default value for the rmi server host address used by the JMX onnector server used only if an rmi server is required for the JMXConnector- See Also:
- Constant Field Values
-
DEFAULT_RMI_PORT
public static final int DEFAULT_RMI_PORT
default value for the rmi server port used by the JMX connector server used only if an rmi server is required for the JMXConnector- See Also:
- Constant Field Values
-
JMX_URL
public static final String JMX_URL
JMX Url pattern for use when creating the connector server- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JMXHelper
public JMXHelper(Rule rule)
constructor allowing this helper to be used as a helper- Parameters:
rule- the rule this helper is attached to
-
-
Method Detail
-
activated
public static void activated()
helper activation method which creates a periodic helper thread to perform periodic calls to the trigger method. should only be called when synchronized on PeriodicHelper.class.
-
deactivated
public static void deactivated()
helper deactivation method which shuts down the periodic helper thread. will only be called when synchronized on PeriodicHelper.class
-
getAttribute
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
- Specified by:
getAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
- Specified by:
setAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionException
-
getAttributes
public AttributeList getAttributes(String[] attributes)
- Specified by:
getAttributesin interfaceDynamicMBean
-
setAttributes
public AttributeList setAttributes(AttributeList attributes)
- Specified by:
setAttributesin interfaceDynamicMBean
-
invoke
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
- Specified by:
invokein interfaceDynamicMBean- Throws:
MBeanExceptionReflectionException
-
getMBeanInfo
public MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfoin interfaceDynamicMBean
-
getValue
public Object getValue(int idx)
getter for counter values used by MBean code- Parameters:
idx- the index into the key list- Returns:
- the associated counter value as an Object
-
-