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