wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Possible mistake in the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Possible mistake in the "...Summary of EJB Certifications for EJB Certification" by Frits Walraven" Watch "Possible mistake in the "...Summary of EJB Certifications for EJB Certification" by Frits Walraven" New topic
Author

Possible mistake in the "...Summary of EJB Certifications for EJB Certification" by Frits Walraven

Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Dear All and dear Frits,

Fist, I like to thanks you for the study notes, they are well done and concise.

Second, I think I locate something that my look like a mistake. In my document version on page 4-42 you have a note that states:

Note: you cannot have an Interceptor on a Timeout method


IMHO and according with the Oracle specification for Interceptors (available http://docs.oracle.com/javaee/6/tutorial/doc/gkedm.html ) you can have interceptors for timeout methods.


Interceptors for EJB timer service timeout methods may be defined using the @AroundTimeout annotation on methods in the target class or in an interceptor class. Only one @AroundTimeout method per class is allowed.


Is this a mistake in your study notes or do I misinterpret something ?


Thanks in advance & best Regards,
Mihai


SCJP, SCJD, SCWCD, OCPJBCD
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1686
    
  25

Hi Mihai,

I am sorry that I couldn't reply earlier as I am on my summer holidays now, far from home

like to thanks you for the study notes, they are well done and concise.

Thanks!

IMHO and according with the Oracle specification for Interceptors (available http://docs.oracle.com/javaee/6/tutorial/doc/gkedm.html ) you can have interceptors for timeout methods.

Yes, that is correct. Chapter 4.2 (in my notes) is about interceptors on EJB timer timeout methods.

What I meant with the note you cannot have an Interceptor on a Timeout method, is that you cannot combine the @Interceptors and @Timeout annotations to define an Interceptor on a timer timeout method, you will have to use the @AroundTimeout annotation. In other words this won't work:


It should be:

Regards,
Frits
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Sorry for the delayed answer, you know holidays.

Just to be sure that I understand your statement right.
You say that @Interceptors annotation can not be used the same method annotated with @Timeout.
This is correct, the reason can be the fist sentence from the Interceptors chapter from the specifications (chapter 12).

Interceptors are used to interpose on business method invocations and lifecycle events that occur on an enterprise bean instance.


As long as a timeout is not a business method then the upper stamen is correct.

Am I right ?


Thanks in advance,
Mihai
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1686
    
  25

Interceptors are used to interpose on business method invocations and lifecycle events that occur on an enterprise bean instance.

Well actually this sentence in the ejb spec is not entirely correct. Apart from intercepting business methods and lifecycle methods you can also intercept timeout methods (by using the @AroundTimeout annotation).

Just browse through the Interceptors v1.1 Specification and you will see the three different EJB related interceptors.

Regards,
Frits
 
GeeCON Prague 2014
 
subject: Possible mistake in the "...Summary of EJB Certifications for EJB Certification" by Frits Walraven