[jboss-user] [EJB 3.0] - Re: Possibility to test passivation / activation of SFSB

francis17101970 do-not-reply at jboss.com
Fri Sep 12 10:22:18 EDT 2008


You can test activation/passivation by setting the timeout parameter in the @CacheConfig annotation.

  | @Stateful
  | @CacheConfig(idleTimeoutSeconds=10)
  | public class HelloBean implements HelloBeanItf, Serializable {
  | 
  |  
  | @PrePassivate
  | public void beforePassivate () {
  |   System.out.println("Going to be passivated");
  | }
  | 
  | @PostActivate
  | public void afterActivation () {
  |   System.out.println("Going to be reactivated");
  | }
In this example the EJB will be passivated after 10 seconds. If you try to access to the Bean instance again then it will be reactivated....
Hope it helps

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176147#4176147

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176147



More information about the jboss-user mailing list