1 25 26 package org.objectweb.easybeans.tests.enhancer.interceptors.lifecycle.bean; 27 28 import javax.annotation.PostConstruct; 29 import javax.annotation.PreDestroy; 30 import javax.interceptor.InvocationContext; 31 32 36 public class MyLifeCycleInterceptorStateless { 37 38 42 @PostConstruct 43 public void postConstMethod(final InvocationContext invocationContext) { 44 Object o = invocationContext.getTarget(); 45 if (o instanceof AbsSessionBean) { 46 AbsSessionBean bean = (AbsSessionBean) o; 47 bean.calledPostConstruct(); 48 try { 49 invocationContext.proceed(); 50 } catch (Exception e) { 51 throw new RuntimeException ("Cannot proceed invocationContext", e); 52 } 53 } 54 } 55 56 60 @PreDestroy 61 public void onePreDestroyMethod(final InvocationContext invocationContext) { 62 Object o = invocationContext.getTarget(); 63 if (o instanceof AbsSessionBean) { 64 AbsSessionBean bean = (AbsSessionBean) o; 65 bean.calledPreDestroy(); 66 try { 67 invocationContext.proceed(); 68 } catch (Exception e) { 69 throw new RuntimeException ("Cannot proceed invocationContext", e); 70 } 71 } 72 } 73 } 74 | Popular Tags |