JBoss MBean实现方法
<mbean code="实现类全名路径" name="xxx.xxx.xxx:service=xxxxMBean"/>?XX-xmbean.xml内容
<mbean><description>Demo</description><descriptors><interceptors><interceptor code="test.MyInterceptor"/></interceptors> </descriptors><class>XX</class>?package test;import org.jboss.mx.interceptor.AbstractInterceptor;import org.jboss.mx.interceptor.Interceptor;import org.jboss.mx.server.Invocation;public class MyInterceptor extends AbstractInterceptor {public Object invoke(Invocation invocation) throws Throwable{ log.info("Invocation: " + invocation);AbstractInterceptor ic = invocation.nextInterceptor();if( ic == null ){return invocation.dispatch();}else{long start = System.currentTimeMillis();try{return ic.invoke( invocation );}catch(Exception e){ e.printStackTrace();return null;} //I can wrapp some exceptionfinally{log.info("call time : " + ( System.currentTimeMillis() - start ) );}} }}?这样就可以捕获MBean方法调用了,这个例子是显示MBean方法的调用时间