Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question on Message-Driven Bean Lifecycle Callback Interceptor Methods

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

EJB 3.1 Specification



5.4.5 Message-Driven Bean Lifecycle Callback Interceptor Methods

The following lifecycle event callbacks are supported for message-driven beans. Callback methods may be defined directly on the bean class or on a separate interceptor class

1. PostConstruct
2. PreDestroy



Question :What does line "Callback methods may be defined directly on the bean class or on a separate interceptor class" means here ?
 
Creator of Enthuware JWS+ V6
Posts: 3346
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have an interceptor binding on top of the PostConstruct method, or in the Interceptor class itself

Method signature:
  • In Target class: void <METHOD>()
  • In Interceptor class void <METHOD>(InvocationContext)


  • in Target class

    in Interceptor class

    Regards,
    Frits
     
    Mohit G Gupta
    Ranch Hand
    Posts: 634
    Eclipse IDE Chrome Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Frits,

    Thanks for the reply.
    However,I am still not understanding your statement as my query was regarding "callback methods (PostConstruct,PreDestroy) defined on Bean class or Interceptor class" and your answers says about" Interceptor Bindings on PostConstruct method, or in the Interceptor class itself"

    Please advise.
     
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Posts: 3346
    303
    Android Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Oh yes, you are right they are talking about the lifecycle methods. Well here are the examples:

    in the Session bean class:

    or in the interceptor class (PostConstruct is not called from the EchoBeanRemote class but from its Interceptor)

    Regards,
    Frits
     
    Mohit G Gupta
    Ranch Hand
    Posts: 634
    Eclipse IDE Chrome Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Frits
     
    Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
    Devious Experiments for a Truly Passive Greenhouse!
    https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
      Bookmark Topic Watch Topic
    • New Topic