This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Question on Message-Driven Bean Lifecycle Callback Interceptor Methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Question on Message-Driven Bean Lifecycle Callback Interceptor Methods" Watch "Question on Message-Driven Bean Lifecycle Callback Interceptor Methods" New topic
Author

Question on Message-Driven Bean Lifecycle Callback Interceptor Methods

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

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 ?


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1637
    
  23

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

    Joined: May 18, 2010
    Posts: 634

    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
    Bartender

    Joined: Apr 07, 2010
    Posts: 1637
        
      23

    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

    Joined: May 18, 2010
    Posts: 634

    Thanks Frits
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Question on Message-Driven Bean Lifecycle Callback Interceptor Methods
     
    Similar Threads
    MDB and its strange inheritance
    how many PrePassivate methods we can have in an stateful session bean ?
    Entity callback doubt
    What are Interceptors in context of EJB 3.1
    Lifecycle callback interceptor