Class SpringModelMBean
java.lang.Object
javax.management.modelmbean.RequiredModelMBean
org.springframework.jmx.export.SpringModelMBean
- All Implemented Interfaces:
DynamicMBean, MBeanRegistration, ModelMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, NotificationEmitter, PersistentMBean
Extension of the
RequiredModelMBean class that ensures the
thread context ClassLoader is switched
for the managed resource's ClassLoader before any invocations occur.- Since:
- 2.0
- Author:
- Rob Harrop
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new SpringModelMBean instance with an emptyModelMBeanInfo.Construct a new SpringModelMBean instance with the givenModelMBeanInfo. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String attrName) Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.getAttributes(String[] attrNames) Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.voidsetAttribute(Attribute attribute) Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.setAttributes(AttributeList attributes) Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.voidsetManagedResource(Object managedResource, String managedResourceType) Sets managed resource to expose and stores itsClassLoader.Methods inherited from class RequiredModelMBean
addAttributeChangeNotificationListener, addNotificationListener, getClassLoaderRepository, getMBeanInfo, getNotificationInfo, load, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setModelMBeanInfo, store
-
Constructor Details
-
SpringModelMBean
Construct a new SpringModelMBean instance with an emptyModelMBeanInfo.- Throws:
MBeanExceptionRuntimeOperationsException- See Also:
-
SpringModelMBean
Construct a new SpringModelMBean instance with the givenModelMBeanInfo.- Throws:
MBeanExceptionRuntimeOperationsException- See Also:
-
-
Method Details
-
setManagedResource
public void setManagedResource(Object managedResource, String managedResourceType) throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException Sets managed resource to expose and stores itsClassLoader.- Specified by:
setManagedResourcein interfaceModelMBean- Overrides:
setManagedResourcein classRequiredModelMBean- Throws:
MBeanExceptionInstanceNotFoundExceptionInvalidTargetObjectTypeException
-
invoke
public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.- Specified by:
invokein interfaceDynamicMBean- Overrides:
invokein classRequiredModelMBean- Throws:
MBeanExceptionReflectionException- See Also:
-
getAttribute
public Object getAttribute(String attrName) throws AttributeNotFoundException, MBeanException, ReflectionException Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.- Specified by:
getAttributein interfaceDynamicMBean- Overrides:
getAttributein classRequiredModelMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException- See Also:
-
getAttributes
Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.- Specified by:
getAttributesin interfaceDynamicMBean- Overrides:
getAttributesin classRequiredModelMBean- See Also:
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.- Specified by:
setAttributein interfaceDynamicMBean- Overrides:
setAttributein classRequiredModelMBean- Throws:
AttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionException- See Also:
-
setAttributes
Switches thecontext ClassLoaderfor the managed resourcesClassLoaderbefore allowing the invocation to occur.- Specified by:
setAttributesin interfaceDynamicMBean- Overrides:
setAttributesin classRequiredModelMBean- See Also:
-