nerdexam
Oracle

1Z0-895 · Question #37

A developer writes three interceptor classes: AInt, BInt, and CInt. Each interceptor class defines an AroundInvoke method called interceptor. In the ejb-jar.xml descriptor, CInt is declared as the…

The correct answer is B. CInt, BInt. The default Intercepter, CInt, comes first. The class intercepter AInt is excluded by @ExcludeClassInterceptors, so the Method Intercepter BInt would be next in order. Note 1: By default the ordering of interceptors when invoking a method are External interceptors Default…

Interceptors

Question

A developer writes three interceptor classes: AInt, BInt, and CInt. Each interceptor class defines an AroundInvoke method called interceptor. In the ejb-jar.xml descriptor, CInt is declared as the default interceptor. FooBean is a stateless session bean with a local business interface Foo that declares a method Foo (): 10. @Stateless 11. @Interceptors(AInt.class) 12. public class FooBean Implements Foo { 13. 14. @Interceptors (BInt.class) 15. @ExcludeClassInterceptors 16. public void foo () {} 17. } What is the interceptor order when the business method foo () is invoked?

Options

  • ABInt
  • BCInt, BInt
  • CCInt, AInt, BInt
  • DBInt, AInt, CInt

How the community answered

(38 responses)
  • A
    5% (2)
  • B
    82% (31)
  • C
    3% (1)
  • D
    11% (4)

Explanation

The default Intercepter, CInt, comes first. The class intercepter AInt is excluded by @ExcludeClassInterceptors, so the Method Intercepter BInt would be next in order. 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: Annotation Type ExcludeClassInterceptors Used to exclude class-level interceptors for a business method or timeout method of a target class. EJB Interceptors

Topics

#interceptor ordering#default interceptors#ExcludeClassInterceptors#AroundInvoke

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice