• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Ranch Hand
Posts: 312
6
  • 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();
...
}
}


 
Creator of Enthuware JWS+ V6
Posts: 3348
303
Android Eclipse IDE Chrome
  • 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:
 
Where does a nanny get ground to air missles? Protect this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic