1 22 package org.jboss.test.jmx.interceptors; 23 24 import org.jboss.mx.server.Invocation; 25 import org.jboss.system.InterceptorServiceMBeanSupport; 26 27 34 public class AdderInterceptorService extends InterceptorServiceMBeanSupport 35 implements AdderInterceptorServiceMBean 36 { 37 public AdderInterceptorService() 38 { 39 } 41 42 protected void startService() throws Exception 43 { 44 super.attach(); 46 } 47 48 protected void stopService() 49 { 50 super.detach(); 52 } 53 54 57 protected Object invoke(Invocation invocation) throws Throwable 58 { 59 String type = invocation.getType(); 60 61 if (type.equals(Invocation.OP_INVOKE)) 62 { 63 String name = invocation.getName(); 64 65 if (name.equals("add")) 66 { 67 Integer result = (Integer )super.invoke(invocation); 68 69 return new Integer (result.intValue() + 1); 70 } 71 } 72 return super.invoke(invocation); 73 } 74 } 75 | Popular Tags |