exam questions

Exam 1z0-895 All Questions

View all questions & answers for the 1z0-895 exam

Exam 1z0-895 topic 1 question 25 discussion

Actual exam question from Oracle's 1z0-895
Question #: 25
Topic #: 1
[All 1z0-895 Questions]

An ejb-jar also contains three interceptor classes: AInt, BInt, CInt. Each interceptor class defines an AroundInvoke method called intercept.
The ejb-jar also contains a stateless session bean FooBean with a local business interface Foo that declares a method foo ():
10. @Stateless
11. @Intercaptors ({CInt.class, BInt.class})
12. public class FooBean implements Foo {
13.
14. public void foo () {}
15.
16. }
The ejb-jar contains a META-INF/ejb-jar.xml file with an <interceptor-binding> section:
<interceptor-binding>
<ejb-name>FooBean</ejb-name>
<interceptor-order>
<interceptor.class>com.acme.AInt</interceptor-class>
</interceptor-order>
</interceptor.binding>
What is the interceptor order when the business methodfoo() is invoked?

  • A. AInt
  • B. AInt, CInt, BInt
  • C. CInt, BInt, AInt
  • D. AInt, BInt, CInt
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
With the interceptor-order clauses Aint will be first in the order of interceptors.
Within each group (default, class, method) the order of the interceptors are from left to right as defined in the @Interceptors annotation, and then the xml interceptors.
In this scenario, with the @Intercaptors ({CInt.class, BInt.class}) line, the ordering continues with CInt and BInt.
Note 1: By default the ordering of interceptors when invoking a method are
* External interceptors
** Default interceptors, if present
** Class interceptors, if present
** Method interceptors, if present
* Bean class interceptor method
Note 2: You can override the default sort order of the external interceptors by specifiying an interceptor-binding with an interceptor-order specifying the order of the interceptors

Reference: EJB Interceptors -
http://docs.jboss.org/ejb3/app-server/tutorial/interceptor/interceptor.html

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...