This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Interceptor - Excecution Order

 
Ashwin Kumar
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the specs the Invocation order is Default > Class > Method

What should be order if the super class has @AroundInvoke method, and when the subclass method is called ?



Which is correct when "amethod" is invoked and Why ?

Option 1 > test1 > test2

Option 2 > test2 > test1
 
Aditya Vasudeva
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shonak,

the correct answer is Option2 > test2 test1

when you inherit a class which has @AroundInvoke, it is intercepted first and then the subclass continues.
Option 1 is not a valid answer.

If you have not understood, click on this link :
http://docs.jboss.org/ejb3/app-server/tutorial/interceptor/interceptor.html
and see Inheritance Ordering.

Keep Programming.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!