aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 1661
    
  25

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: 1661
        
      25

    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