• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

defined on a bean class: lifecycle event callback VERSUS lifecycle callback interceptor method

 
Charles O'Leary
Ranch Hand
Posts: 54
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When defined on a EJB 3.0 core bean class, what, if any, are the differences between a "lifecycle event callback" and a "lifecycle callback interceptor method"?

In the spec code below, @PreDestroy is defined on the bean class. Is endShoppingCart() a lifecycle event callback or a lifecycle callback interceptor method?


@Stateful public class ShoppingCartBean implements ShoppingCart {
private float total;
private Vector productCodes;
public int someShoppingMethod(){...};
...
@PreDestroy void endShoppingCart() {...};
}
public class MyInterceptor {
...
@PostConstruct
public void any-method-name (InvocationContext ctx) {
...
ctx.proceed();
...
}
@PreDestroy
public void any-other-method-name (InvocationContext ctx) {
...
ctx.proceed();
...
}
}

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2533
113
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interceptor methods can be bound to a lifecycle callback method: in other words you can intercept the call to the lifecycle callback method (e.g. @PostConstruct)

For example:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic