Skip to content

Commit

Permalink
allow lifecycle extension of @dependent looked up beans in implementa…
Browse files Browse the repository at this point in the history
…tion-defined manner
  • Loading branch information
Ladicek committed Feb 8, 2024
1 parent c366a90 commit 0b8a36f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/src/main/asciidoc/core/invokers.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ Implementations are permitted to remember the identified beans and not repeat th
All instances of `@Dependent` looked up beans obtained during `Invoker.invoke()` are destroyed before the `invoke()` method returns or throws.
The order in which the instances of `@Dependent` looked up beans are destroyed is not specified.

Implementations are permitted to extend the lifecycle of `@Dependent` looked up beans when they can conclusively determine that code called by the target method is capable of using the instances after the method returns.
Such lifecycle extension must not be infinite; the instances of `@Dependent` looked up beans must eventually be destroyed.
Implementations that do this must document the conditions under which such lifecycle extension applies and when the destruction happens.

NOTE: It is expected that implementations that feature direct support for asynchronous programming will extend the lifecycle of `@Dependent` looked up beans until the asynchronous action started by the target method completes.
An "asynchronous" target method is typically recognized by return type, such as `CompletionStage` or `CompletableFuture`, or by presence of a special parameter, such as `AsyncResponse` in Jakarta REST.

The order in which instances of looked up beans are obtained during `Invoker.invoke()` in not specified.

If an exception is thrown when creating an instance of a looked up bean during `Invoker.invoke()`, the exception is rethrown.
Expand Down

0 comments on commit 0b8a36f

Please sign in to comment.