Package org.jgroups.jmx
Class ResourceDMBean
- java.lang.Object
-
- org.jgroups.jmx.ResourceDMBean
-
- All Implemented Interfaces:
javax.management.DynamicMBean
public class ResourceDMBean extends java.lang.Object implements javax.management.DynamicMBeanA DynamicMBean wrapping an annotated object instance and exposing attributes annotated with @ManagedAttribute and operations annotated with @ManagedOperation.- Author:
- Chris Mills, Vladimir Blagojevic, Bela Ban
- See Also:
ManagedAttribute,ManagedOperation,MBean
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResourceDMBean.Accessorprotected static classResourceDMBean.AttributeEntrystatic classResourceDMBean.FieldAccessorstatic classResourceDMBean.MethodAccessorstatic classResourceDMBean.NoopAccessor
-
Field Summary
Fields Modifier and Type Field Description protected javax.management.MBeanAttributeInfo[]attrInfoprotected java.util.HashMap<java.lang.String,ResourceDMBean.AttributeEntry>attsprotected booleanexpose_allprotected static java.util.function.Predicate<java.lang.reflect.AccessibleObject>FILTERprotected Loglogprotected java.lang.Objectobjprotected static java.util.List<java.lang.reflect.Method>OBJECT_METHODSprotected java.util.List<java.lang.Object>objsprotected javax.management.MBeanOperationInfo[]opInfoprotected java.util.List<javax.management.MBeanOperationInfo>opsprotected static java.lang.Class<?>[]primitives
-
Constructor Summary
Constructors Constructor Description ResourceDMBean(java.lang.Object instance)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voiddumpStats(java.lang.Object obj, java.util.Map<java.lang.String,java.lang.Object> map, Log log)protected voidexposeManagedAttribute(java.lang.reflect.Method method, java.lang.Object instance)protected voidfindFields(java.lang.Object instance)protected static ResourceDMBean.AccessorfindGetter(java.lang.Object target, java.lang.String attr_name)Finds an accessor for an attribute.protected voidfindMethods(java.lang.Object instance)static ResourceDMBean.AccessorfindSetter(java.lang.Object target, java.lang.String attr_name)Finds an accessor for an attribute.protected voidfixFields(java.lang.Object instance)Provides field-based getter and/or setters for all attributes in attrs if not presentjava.lang.ObjectgetAttribute(java.lang.String name)javax.management.AttributeListgetAttributes(java.lang.String[] names)protected static java.lang.Class<?>getClassForName(java.lang.String name)javax.management.MBeanInfogetMBeanInfo()protected javax.management.AttributegetNamedAttribute(java.lang.String name)java.lang.Objectinvoke(java.lang.String name, java.lang.Object[] args, java.lang.String[] sig)static booleanisGetMethod(java.lang.reflect.Method method)static booleanisIsMethod(java.lang.reflect.Method method)static booleanisSetMethod(java.lang.reflect.Method method)voidsetAttribute(javax.management.Attribute attribute)javax.management.AttributeListsetAttributes(javax.management.AttributeList list)protected booleansetNamedAttribute(javax.management.Attribute attribute)protected static java.lang.StringtoLowerCase(java.lang.String input)Returns a string with the first letter being lowercase
-
-
-
Field Detail
-
primitives
protected static final java.lang.Class<?>[] primitives
-
OBJECT_METHODS
protected static final java.util.List<java.lang.reflect.Method> OBJECT_METHODS
-
expose_all
protected final boolean expose_all
-
log
protected final Log log
-
obj
protected final java.lang.Object obj
-
objs
protected java.util.List<java.lang.Object> objs
-
attrInfo
protected final javax.management.MBeanAttributeInfo[] attrInfo
-
opInfo
protected final javax.management.MBeanOperationInfo[] opInfo
-
atts
protected final java.util.HashMap<java.lang.String,ResourceDMBean.AttributeEntry> atts
-
ops
protected final java.util.List<javax.management.MBeanOperationInfo> ops
-
FILTER
protected static final java.util.function.Predicate<java.lang.reflect.AccessibleObject> FILTER
-
-
Method Detail
-
getMBeanInfo
public javax.management.MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfoin interfacejavax.management.DynamicMBean
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Specified by:
getAttributein interfacejavax.management.DynamicMBean
-
setAttribute
public void setAttribute(javax.management.Attribute attribute)
- Specified by:
setAttributein interfacejavax.management.DynamicMBean
-
getAttributes
public javax.management.AttributeList getAttributes(java.lang.String[] names)
- Specified by:
getAttributesin interfacejavax.management.DynamicMBean
-
setAttributes
public javax.management.AttributeList setAttributes(javax.management.AttributeList list)
- Specified by:
setAttributesin interfacejavax.management.DynamicMBean
-
invoke
public java.lang.Object invoke(java.lang.String name, java.lang.Object[] args, java.lang.String[] sig) throws javax.management.MBeanException, javax.management.ReflectionException- Specified by:
invokein interfacejavax.management.DynamicMBean- Throws:
javax.management.MBeanExceptionjavax.management.ReflectionException
-
isSetMethod
public static boolean isSetMethod(java.lang.reflect.Method method)
-
isGetMethod
public static boolean isGetMethod(java.lang.reflect.Method method)
-
isIsMethod
public static boolean isIsMethod(java.lang.reflect.Method method)
-
dumpStats
public static void dumpStats(java.lang.Object obj, java.util.Map<java.lang.String,java.lang.Object> map, Log log)
-
getClassForName
protected static java.lang.Class<?> getClassForName(java.lang.String name) throws java.lang.ClassNotFoundException- Throws:
java.lang.ClassNotFoundException
-
findMethods
protected void findMethods(java.lang.Object instance)
-
fixFields
protected void fixFields(java.lang.Object instance)
Provides field-based getter and/or setters for all attributes in attrs if not present
-
exposeManagedAttribute
protected void exposeManagedAttribute(java.lang.reflect.Method method, java.lang.Object instance)
-
findGetter
protected static ResourceDMBean.Accessor findGetter(java.lang.Object target, java.lang.String attr_name)
Finds an accessor for an attribute. Tries to find getAttrName(), isAttrName(), attrName() methods. If not found, tries to use reflection to get the value of attr_name. If still not found, creates a NullAccessor.
-
findSetter
public static ResourceDMBean.Accessor findSetter(java.lang.Object target, java.lang.String attr_name)
Finds an accessor for an attribute. Tries to find setAttrName(), attrName() methods. If not found, tries to use reflection to set the value of attr_name. If still not found, creates a NullAccessor.
-
toLowerCase
protected static java.lang.String toLowerCase(java.lang.String input)
Returns a string with the first letter being lowercase
-
findFields
protected void findFields(java.lang.Object instance)
-
getNamedAttribute
protected javax.management.Attribute getNamedAttribute(java.lang.String name)
-
setNamedAttribute
protected boolean setNamedAttribute(javax.management.Attribute attribute)
-
-