Skip to content

Commit

Permalink
Renamed Chapter 'Use of the Priority Annotation in Ordering Intercept…
Browse files Browse the repository at this point in the history
…ors' to 'Ordering Interceptors using the Priority Annotation'

Fixed formatting errors.
Fixed mismatched references.

Signed-off-by: thadumi <th.theodor.th@gmail.com>
  • Loading branch information
thadumi committed Mar 27, 2020
1 parent f76e3ce commit e13ad46
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 68 deletions.
8 changes: 4 additions & 4 deletions spec/src/main/asciidoc/chapters/appendix/footnotes.adoc
Expand Up @@ -9,13 +9,13 @@
////

// a567
:fn-1: footnote:fn1[If a _PostConstruct_ \
:fn-1: footnote:fn1[If a PostConstruct \
interceptor method is declared in the interceptor class or a superclass \
of the interceptor class, it is not invoked when the interceptor \
instance itself is created.]

// a568
:fn-2: footnote:fn2[If a _PreDestroy_ \
:fn-2: footnote:fn2[If a PreDestroy \
interceptor method is declared in the interceptor class or a superclass \
of the interceptor class, it is not invoked when the interceptor \
instance itself is destroyed.]
Expand All @@ -28,7 +28,7 @@ parameter of type T[].]
// a570
:fn-4: footnote:fn4[In case of the \
PostConstruct interceptor, if there is no callback method defined on the \
target class, the invocation of _InvocationContext.proceed_ method in \
target class, the invocation of InvocationContext.proceed method in \
the last interceptor method in the chain validates the target instance.]

// a571
Expand All @@ -50,4 +50,4 @@ invocation chain.]
:fn-7: footnote:fn7[This requirement follows the rules from the Jakarta Annotations specification, section 2.1 <<bib5>>.]

// a574
:fn-8: footnote:fn8[The _Priority_ annotation also orders interceptors. See Chapter <<interceptor_ordering>>.]
:fn-8: footnote:fn8[The Priority annotation also orders interceptors. See Chapter <<interceptor_ordering>>.]
Expand Up @@ -20,12 +20,12 @@ The _Interceptors_ annotation can be applied
to the target class or to a method or a constructor declared in the
target class or in a superclass of the target class:

Method-level around-invoke and around-timeout
- Method-level around-invoke and around-timeout
interceptors can be defined by applying the _Interceptors_ annotation to
the method for which the around-invoke or around-timeout interceptor
methods are to be invoked.

Constructor-level interceptors can be defined
- Constructor-level interceptors can be defined
by applying the _Interceptors_ annotation to the constructor for which
the around-construct interceptor methods are to be invoked.

Expand Down
Expand Up @@ -16,7 +16,7 @@ eligible to be invoked.

Interceptors declared using interceptor
bindings are enabled using the Priority annotation (see Section
<<use_of_the_priority_annotation_in_ordering_interceptors>>).
<<ordering_interceptors_using_the_priority_annotation>>).
The _Priority_ annotation also controls
interceptor ordering (see Section <<interceptor_ordering_rules>>).

Expand All @@ -38,8 +38,8 @@ deployment descriptor <<bib2>>) to
enable and order interceptors, to override the order specified by means
of annotations, or to disable interceptors.

Note: The _InvocationContext_ object allows
_Note: The InvocationContext object allows
interceptor methods to control the behavior of the invocation chain,
including whether the next method in the chain is invoked and the values
of its parameters and result. See Section
<<invocation_context>>.
<<invocation_context>>._
Expand Up @@ -15,6 +15,6 @@ include::enabling_interceptors.adoc[]

include::interceptor_ordering_rules.adoc[]

include::use_of_the_priority_annotation_in_ordering_interceptors.adoc[]
include::ordering_interceptors_using_the_priority_annotation.adoc[]

include::excluding_interceptors.adoc[]
Expand Up @@ -16,80 +16,80 @@ 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 first.

Default interceptors are invoked in the order
- 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
- 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 declared by applying the
Interceptors annotation _at class-level_ to the target class are invoked
next.

Interceptor methods declared in the
- 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
- 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
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 declared by applying the
Interceptors annotation _at method- or constructor-level_ are invoked
next.

Interceptor methods declared in the
- 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
- 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
- Interceptors declared using interceptor
bindings are invoked next.

All interceptors specified using interceptor
- 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>>.
<<ordering_interceptors_using_the_priority_annotation>>.

If an interceptor class declared using
- 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
- Interceptor methods declared in the target
class or in any superclass of the target class are invoked last.

If the target class has superclasses,
- 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
- If an interceptor method is overridden by
another method (regardless whether that method is itself an interceptor
method), it will not be invoked.

Expand Up @@ -8,8 +8,8 @@
*******************************************************************
////

[[use_of_the_priority_annotation_in_ordering_interceptors]]
=== Use of the Priority Annotation in Ordering Interceptors
[[ordering_interceptors_using_the_priority_annotation]]
=== Ordering Interceptors using the Priority Annotation

The _Priority_ annotation can be used to
enable and order interceptors associated with components that use
Expand Down Expand Up @@ -40,42 +40,42 @@ interceptor ordering when used with the Priority annotation.
Interceptors with lower priority values are invoked earlier in the
interceptor chain.

- Interceptor.Priority.PLATFORM_BEFORE = 0
- _Interceptor.Priority.PLATFORM_BEFORE_ = 0

- Interceptor.Priority.LIBRARY_BEFORE = 1000
- _Interceptor.Priority.LIBRARY_BEFORE_ = 1000

- Interceptor.Priority.APPLICATION = 2000
- _Interceptor.Priority.APPLICATION_ = 2000

- Interceptor.Priority.LIBRARY_AFTER = 3000
- _Interceptor.Priority.LIBRARY_AFTER_ = 3000

- Interceptor.Priority.PLATFORM_AFTER = 4000
- _Interceptor.Priority.PLATFORM_AFTER_ = 4000

These values define the following interceptor
ranges to order interceptors for a specific interposed method or event
in the interceptor chain:

Interceptors defined by the Jakarta EE Platform
- Interceptors defined by the Jakarta EE Platform
specifications that are to be executed at the beginning of the
interceptor chain should have priority values in the range
PLATFORM_BEFORE up until LIBRARY_BEFORE.

Interceptors defined by extension libraries
- Interceptors defined by extension libraries
that are intended to be executed earlier in the interceptor chain, but
after interceptors in the range up until _LIBRARY_BEFORE_ should have
priority values in the range LIBRARY_BEFORE up until APPLICATION.

Interceptors defined by applications should
- Interceptors defined by applications should
be in the range APPLICATION up until LIBRARY_AFTER.

Interceptors defined by extension libraries
- Interceptors defined by extension libraries
that are intended to be executed later in the interceptor chain should
have priority values in the range LIBRARY_AFTER up until PLATFORM_AFTER.

Interceptors defined by the Jakarta EE Platform
- Interceptors defined by the Jakarta EE Platform
specifications that are to be executed at the end of the interceptor
chain should have priority values at PLATFORM_AFTER or higher.

An interceptor that must be invoked before or
- An interceptor that must be invoked before or
after another defined interceptor can choose any appropriate value.

Negative priority values are reserved for
Expand Down
Expand Up @@ -27,13 +27,13 @@ method must not be declared as _abstract, final or static_ .
Around-invoke methods have the following
signature:

_Object_ __ _<METHOD>(InvocationContext)_
Object <METHOD>(InvocationContext) throws Exception

Note: An around-invoke interceptor method may
_Note: An around-invoke interceptor method may
be declared to throw any checked exceptions that the associated target
method allows within its throws clause. It may be declared to throw the
java.lang.Exception, _for example, if it_ interposes on several methods
that can throw unrelated checked exceptions.
java.lang.Exception, for example, if it interposes on several methods
that can throw unrelated checked exceptions._

An around-invoke method can invoke any
component or resource that the method it is intercepting can invoke.
Expand Down
Expand Up @@ -25,44 +25,44 @@ dependency injection. Dependency injection is performed when the
interceptor instance is created, using the naming context of the
associated target class.

With the exception of around-construct
With the exception of _AroundConstruct_
lifecycle callback interceptor methods, no interceptor methods are
invoked until after dependency injection has been completed on both the
interceptor instances and the target {fn-1}.

Post-construct interceptor methods for the
_PostConstruct_ interceptor methods for the
target instance are invoked after dependency injection has been
completed on the target instance.

{empty}Pre-destroy interceptor methods are
_PreDestroy_ interceptor methods are
invoked before the target instance and all interceptor instances
associated with it are destroyed.{fn-2}

The following rules apply specifically to
around-construct lifecycle callback interceptor methods:
_AroundConstruct_ lifecycle callback interceptor methods:

Around-construct lifecycle callback
- _AroundConstruct_ lifecycle callback
interceptor methods are invoked after dependency injection has been
completed on the instances of all interceptor classes associated with
the target class. Injection of the target component into interceptor
instances that are invoked during the around-construct lifecycle
instances that are invoked during the _AroundConstruct_ lifecycle
callback is not supported.

The target instance is created _after_ the
last interceptor method in the around-construct interceptor chain
invokes the InvocationContext.proceed method. If the constructor for the
- The target instance is created _after_ the
last interceptor method in the _AroundConstruct_ interceptor chain
invokes the _InvocationContext.proceed_ method. If the constructor for the
target instance supports injection, such constructor injection is
performed. If the InvocationContext.proceed method is not invoked by an
performed. If the _InvocationContext.proceed_ method is not invoked by an
interceptor method, the target instance will not be created.

An around-construct interceptor method can
access the constructed instance using the InvocationContext.getTarget
method after the InvocationContext.proceed method completes.
- An _AroundConstruct_ interceptor method can
access the constructed instance using the _InvocationContext.getTarget_
method after the _InvocationContext.proceed_ method completes.

Dependency injection on the target instance
- Dependency injection on the target instance
other than constructor injection is not completed until after the
invocations of all interceptor methods in the around-construct
interceptor chain complete successfully. Around-construct lifecycle
invocations of all interceptor methods in the _AroundConstruct_
interceptor chain complete successfully. _AroundConstruct_ lifecycle
callback interceptor methods should therefore exercise caution when
invoking methods of the target instance since dependency injection on
the target instance will not have been completed.
Expand Down
Expand Up @@ -61,22 +61,21 @@ Lifecycle callback interceptor methods
declared in an interceptor class or superclass of an interceptor class
must have one of the following signatures:

_void <METHOD>(InvocationContext)_
void <METHOD>(InvocationContext)
Object <METHOD>(InvocationContext)

_Object <METHOD>(InvocationContext)_

Note: A lifecycle callback interceptor method
_Note: A lifecycle callback interceptor method
may be declared to throw checked exceptions including the
java.lang.Exception if the same interceptor method interposes on
business or timeout methods in addition to lifecycle events. If such an
interceptor method returns a value, the value is ignored by the
container when the method is invoked to interpose on a lifecycle event.
container when the method is invoked to interpose on a lifecycle event._

Lifecycle callback interceptor methods
declared in a target class or in a superclass of a target class must
have the following signature:

_void <METHOD>()_
void <METHOD>()

The following example declares lifecycle
callback interceptor methods in both the interceptor class and the
Expand Down
Expand Up @@ -15,7 +15,7 @@ Interceptor methods that interpose on timeout
methods are denoted by the _AroundTimeout_ annotation.

NOTE: Timeout methods are currently specific
to Enterprise JavaBeans, although Timer Service functionality may be
to Jakarta Enterprise Beans, although Timer Service functionality may be
extended to other specifications in the future, and extension
specifications may define events that may be interposed on by
around-timeout methods. The EJB Timer Service, defined by the Jakarta Enterprise
Expand All @@ -37,7 +37,7 @@ method must not be declared as abstract, _final_ or _static_ .
Around-timeout methods have the following
signature:

_Object <METHOD>(InvocationContext)_ __ __
Object <METHOD>(InvocationContext) throws Exception

Note: An around-timeout interceptor method
should not throw application exceptions, but it may be declared to throw
Expand Down

0 comments on commit e13ad46

Please sign in to comment.