Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Message-Driven Bean Lifecycle Callback Interceptor Methods

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE 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 ?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2447
96
Android Chrome Eclipse IDE
  • 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
    Chrome Eclipse IDE 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
    Saloon Keeper
    Pie
    Posts: 2447
    96
    Android Chrome Eclipse IDE
    • 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
    Chrome Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Frits
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic