Skip to content

Latest commit

 

History

History
95 lines (76 loc) · 3.85 KB

interceptor_ordering_rules.adoc

File metadata and controls

95 lines (76 loc) · 3.85 KB

Interceptor Ordering Rules

For each interceptor method type (i.e., around-invoke, around-timeout, post-construct, etc.), the following interceptor invocation ordering rules apply, except as specified otherwise by an extension specification.

Default interceptors are invoked first.

Default interceptors are invoked in the order defined by the extension specification (e.g., by their order in the deployment descriptor).

If a default interceptor class has superclasses, interceptor methods declared in the interceptor class’s superclasses are invoked before the interceptor method declared in the interceptor class itself, most general superclass first.

Interceptors declared by applying the Interceptors annotation at class-level to the target class are invoked next.

Interceptor methods declared in the interceptor classes listed in the Interceptors annotation are invoked in the same order as the specification of the interceptor classes in that annotation.

If an interceptor class declared by applying the Interceptors annotation at class-level has superclasses, interceptor methods declared in the interceptor class’s superclasses are invoked before the interceptor method declared in the interceptor class itself, most general superclass first.

 NOTE: This specification does not define
the semantics of applying the Interceptors annotation to a superclass of
the target class, and thus the corresponding interceptor methods may or
may not be invoked. Applications that specify the Interceptors
annotation on a superclass of the target class will not be portable.

Interceptors declared by applying the Interceptors annotation at method- or constructor-level are invoked next.

Interceptor methods declared in the interceptor classes listed in the Interceptors annotation are invoked in the same order as the specification of the interceptor classes in that annotation.

If an interceptor class declared by applying the Interceptors annotation at method- or constructor-level has superclasses, interceptor methods declared in the interceptor class’s superclasses are invoked before the interceptor method declared in the interceptor class itself, most general superclass first.

Interceptors declared using interceptor bindings are invoked next.

All interceptors specified using interceptor binding annotations visible on the target class (e.g., specified on the class or visible on the class because they were declared with the Inherited annotation) are combined with all binding annotations on the target method and sorted by the priorities specified by the Priority annotation; and then the interceptor methods are invoked in order of priority. The Priority annotation is described in Section [use_of_the_priority_annotation_in_ordering_interceptors].

If an interceptor class declared using interceptor bindings has superclasses, interceptor methods declared in the interceptor class’s superclasses are invoked before the interceptor method declared in the interceptor class itself, most general superclass first.

Interceptor methods declared in the target class or in any superclass of the target class are invoked last.

If the target class has superclasses, interceptor methods declared in the target class’s superclasses are invoked before an interceptor method declared in the target class itself, most general superclass first.

If an interceptor method is overridden by another method (regardless whether that method is itself an interceptor method), it will not be invoked.