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.ejb.PostActivate ; 31 import javax.ejb.PrePassivate ; 32 import javax.ejb.Stateful ; 33 import javax.interceptor.Interceptors; 34 35 39 @Stateful (name = "HelloWorldbean3") 40 @Interceptors(MyLifeCycleInterceptorStateful.class) 41 public class StatefulBean extends AbsSessionBean implements SessionBeanItf { 42 43 46 private boolean prePassivateCalled = false; 47 48 49 52 private boolean postActivateCalled = false; 53 54 55 58 private int counter; 59 60 63 public void calledPrePassivate() { 64 this.prePassivateCalled = true; 65 } 66 67 70 public boolean isprePassivateCalled() { 71 return prePassivateCalled; 72 } 73 74 75 78 public void calledPostActivate() { 79 this.postActivateCalled = true; 80 } 81 82 83 86 public boolean isPostActivateCalled() { 87 return postActivateCalled; 88 } 89 90 91 92 95 @PostConstruct 96 @PreDestroy 97 @PostActivate 98 @PrePassivate 99 public void increment() { 100 counter++; 101 } 102 103 106 public int getCounter() { 107 return counter; 108 } 109 110 } 111 | Popular Tags |