Package org.springframework.jmx.export
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
ConstructorDescriptionConstruct a new SpringModelMBean instance with an emptyModelMBeanInfo
.Construct a new SpringModelMBean instance with the givenModelMBeanInfo
. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String attrName) Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.getAttributes
(String[] attrNames) Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.void
setAttribute
(Attribute attribute) Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.setAttributes
(AttributeList attributes) Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.void
setManagedResource
(Object managedResource, String managedResourceType) Sets managed resource to expose and stores itsClassLoader
.Methods inherited from class javax.management.modelmbean.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:
MBeanException
RuntimeOperationsException
- See Also:
-
SpringModelMBean
Construct a new SpringModelMBean instance with the givenModelMBeanInfo
.- Throws:
MBeanException
RuntimeOperationsException
- 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:
setManagedResource
in interfaceModelMBean
- Overrides:
setManagedResource
in classRequiredModelMBean
- Throws:
MBeanException
InstanceNotFoundException
InvalidTargetObjectTypeException
-
invoke
public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.- Specified by:
invoke
in interfaceDynamicMBean
- Overrides:
invoke
in classRequiredModelMBean
- Throws:
MBeanException
ReflectionException
- See Also:
-
getAttribute
public Object getAttribute(String attrName) throws AttributeNotFoundException, MBeanException, ReflectionException Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.- Specified by:
getAttribute
in interfaceDynamicMBean
- Overrides:
getAttribute
in classRequiredModelMBean
- Throws:
AttributeNotFoundException
MBeanException
ReflectionException
- See Also:
-
getAttributes
Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.- Specified by:
getAttributes
in interfaceDynamicMBean
- Overrides:
getAttributes
in classRequiredModelMBean
- See Also:
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.- Specified by:
setAttribute
in interfaceDynamicMBean
- Overrides:
setAttribute
in classRequiredModelMBean
- Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
- See Also:
-
setAttributes
Switches thecontext ClassLoader
for the managed resourcesClassLoader
before allowing the invocation to occur.- Specified by:
setAttributes
in interfaceDynamicMBean
- Overrides:
setAttributes
in classRequiredModelMBean
- See Also:
-