If a resource method is annotated with
@Leave and is invoked in the context of
an LRA and if the bean class has registered a participant with that LRA then
it will be removed from the LRA just before the bean method is entered.
The participant can forget about this LRA, in particular it will not
be asked to complete or compensate when the LRA is subsequently ended.
Even though the method runs without an LRA context, the implementation
MUST still make the context available via a JAX-RS header and any outgoing
JAX-RS invocations performed by the method will still carry the context that
the participant has just left. Therefore the business logic must be
careful about any JAX-RS invocations it makes in the body of the annotated
method which may result in other resources being enlisted with the LRA.
If the resource method (or class) is also annotated with
@LRA the method will
execute with the context dictated by the
@LRA annotation. If this
results in the creation of a new LRA then the participant will still be removed
from the incoming context and will be enlisted with the new context (and the method
will execute with this new context). Note that in this case the context exposed in
@LRA_HTTP_CONTEXT_HEADER JAX-RS header will be set to the new LRA (and
not the original one), i.e., the original context will not be available to the business logic.
Also note that it is not possible to join or leave an LRA that has already been asked to cancel or close since that would conflict with the the participant state model as defined in the LRA specification.
Leaving a particular LRA has no effect on any other LRA - i.e., the same resource can be enlisted with many different LRAs and leaving one particular LRA will not affect its participation in any of the other LRAs it has joined.
Copyright © 2018 – 2021 Eclipse Foundation. All rights reserved.
Use is subject to license terms.