This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 1628
    
  23

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: 1628
    
  23

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Possible mistake in the "...Summary of EJB Certifications for EJB Certification" by Frits Walraven
 
Similar Threads
Passed OCPJP 100% 3 Nov 2010
OCE Java EE 6 EJB Developer passed
Interceptors - more than 1 @AroundInvoke - Multiple @Interceptors declared for a class/method?
What are Interceptors in context of EJB 3.1
Query rgd interceptor invocation order