Java Dynamic Management Kit 5.0 Tutorial

Changing the Default Interceptor

The default interceptor can be changed by using the setDefaultMBeanInterceptor method of the MBeanServerInt interface. The MBeanServerInt interface provides methods for getting and setting the DefaultMBeanInterceptor used for request treatment.


Note –

Particular care must be taken when replacing the default MBean interceptor with a user interceptor. The MBean server implemented in the Java DMK 5.0 passes requests to its default interceptor without checking the result returned, or the exceptions thrown by the interceptor.

Consequently, user interceptors, which implement most of the methods defined in the MBeanServer interface, must behave as specified for the corresponding MBeanServer methods in the JMX 1.1 specification. In particular, a method in an MBean interceptor must not throw any exceptions apart from the following:

If an MBean interceptor does not respect this condition, and, for example, throws a NullPointerException exception, this might have unexpected effects on calling code, which might not be protected against such behavior.