|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jmx.support.JmxUtils
public abstract class JmxUtils
Collection of generic utility methods to support Spring JMX. Includes a convenient method to locate an MBeanServer.
Field Summary | |
---|---|
static String |
IDENTITY_OBJECT_NAME_KEY
The key used when extending an existing ObjectName with the
identity hash code of its corresponding managed resource. |
Constructor Summary | |
---|---|
JmxUtils()
|
Method Summary | |
---|---|
static ObjectName |
appendIdentityToObjectName(ObjectName objectName,
Object managedResource)
Append an additional key/value pair to an existing ObjectName with the key being
the static value identity and the value being the identity hash code of the
managed resource being exposed on the supplied ObjectName . |
static String |
getAttributeName(PropertyDescriptor property,
boolean useStrictCasing)
Return the JMX attribute name to use for the given JavaBeans property. |
static Class |
getClassToExpose(Class beanClass)
Return the class or interface to expose for the given bean class. |
static Class |
getClassToExpose(Object managedBean)
Return the class or interface to expose for the given bean. |
static String[] |
getMethodSignature(Method method)
Create a String[] representing the signature of a method. |
static boolean |
isMBean(Class beanClass)
Check whether the supplied Class is a valid MBean resource. |
static MBeanServer |
locateMBeanServer()
Attempt to find a locally running MBeanServer . |
static MBeanServer |
locateMBeanServer(String agentId)
Attempt to find a locally running MBeanServer . |
static Class[] |
parameterInfoToTypes(MBeanParameterInfo[] paramInfo)
Convert an array of MBeanParameterInfo into an array of
Class instances corresponding to the parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String IDENTITY_OBJECT_NAME_KEY
ObjectName
with the
identity hash code of its corresponding managed resource.
Constructor Detail |
---|
public JmxUtils()
Method Detail |
---|
public static MBeanServer locateMBeanServer() throws MBeanServerNotFoundException
MBeanServer
. Fails if no
MBeanServer
can be found. Logs a warning if more than one
MBeanServer
found, returning the first one from the list.
MBeanServer
if found
MBeanServerNotFoundException
- if no MBeanServer
could be foundMBeanServerFactory.findMBeanServer(java.lang.String)
public static MBeanServer locateMBeanServer(String agentId) throws MBeanServerNotFoundException
MBeanServer
. Fails if no
MBeanServer
can be found. Logs a warning if more than one
MBeanServer
found, returning the first one from the list.
agentId
- the agent identifier of the MBeanServer to retrieve.
If this parameter is null
, all registered MBeanServers are
considered.
MBeanServer
if found
MBeanServerNotFoundException
- if no MBeanServer
could be foundMBeanServerFactory.findMBeanServer(String)
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException
MBeanParameterInfo
into an array of
Class
instances corresponding to the parameters.
ClassNotFoundException
public static String[] getMethodSignature(Method method)
String[]
representing the signature of a method.
Each element in the array is the fully qualified class name
of the corresponding argument in the methods signature.
public static String getAttributeName(PropertyDescriptor property, boolean useStrictCasing)
When using strict casing, a JavaBean property with a getter method
such as getFoo()
translates to an attribute called
Foo
. With strict casing disabled, getFoo()
would translate to just foo
.
property
- the JavaBeans property descriptoruseStrictCasing
- whether to use strict casing
public static boolean isMBean(Class beanClass)
Class
is a valid MBean resource.
beanClass
- the class of the bean to testpublic static Class getClassToExpose(Object managedBean)
Default implementation returns the target class for a CGLIB proxy, and the class of the given bean else (for a JDK proxy or a plain bean class).
managedBean
- the bean instance (might be an AOP proxy)
AopUtils.isCglibProxy(Object)
,
Advised.getTargetSource()
,
TargetSource.getTargetClass()
public static Class getClassToExpose(Class beanClass)
Default implementation returns the superclass for a CGLIB proxy, and the given bean class else (for a JDK proxy or a plain bean class).
beanClass
- the bean class (might be an AOP proxy class)
AopUtils.isCglibProxyClass(Class)
public static ObjectName appendIdentityToObjectName(ObjectName objectName, Object managedResource) throws MalformedObjectNameException
ObjectName
with the key being
the static value identity
and the value being the identity hash code of the
managed resource being exposed on the supplied ObjectName
. This can be used to
provide a unique ObjectName
for each distinct instance of a particular bean or
class. Useful when generating ObjectNames
at runtime for a set of
managed resources based on the template value supplied by a
ObjectNamingStrategy
.
MalformedObjectNameException
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |