1 22 package org.jboss.ejb3.test.interceptors2; 23 24 import javax.interceptor.AroundInvoke; 25 import javax.interceptor.InvocationContext; 26 import javax.naming.InitialContext ; 27 import javax.naming.NamingException ; 28 29 34 public class AnnotatedMethodInterceptor2 extends AnnotatedMethodInterceptor3 35 { 36 private StatusRemote findStatusRemote() 37 { 38 try 39 { 40 InitialContext ctx = new InitialContext (); 41 StatusRemote status = (StatusRemote)ctx.lookup("StatusBean/remote"); 42 return status; 43 } 44 catch (NamingException e) 45 { 46 throw new RuntimeException (e); 47 } 48 } 49 50 @AroundInvoke 51 public Object intercept2(InvocationContext ctx) throws Exception 52 { 53 System.out.println("AnnotatedMethodInterceptor intercepting!"); 54 StatusRemote status = findStatusRemote(); 55 status.addInterception(new Interception(this, "intercept2")); 56 return ctx.proceed(); 57 } 58 59 } 60 | Popular Tags |