Package jakarta.enterprise.invoke
Interface AsyncHandler.ReturnType<T>
- Type Parameters:
T- the async type of the handler
- Enclosing interface:
- AsyncHandler
public static interface AsyncHandler.ReturnType<T>
A return type async handler is a service provider for this interface declared
in
META-INF/services. The async type of a return type async handler is the erasure
of the type argument to the AsyncHandler.ReturnType direct superinterface type.
A target method matches a return type async handler when the erasure of the method's return type is identical to the async type of the async handler.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionCalled once byInvoker.invoke(), after the target method returns.
-
Method Details
-
transform
Called once byInvoker.invoke(), after the target method returns. When the target method throws an exception synchronously, this method is not called.Takes the
originalreturn value and returns a variant of it, transformed such thatcompletion.run()is called on completion. Note thatcompletion.run()must be called exactly once. The result is returned to the invoker caller instead of theoriginal.It is recommended that
completion.run()is called before completion is propagated to the caller.- Parameters:
original- the original asynchronous return valuecompletion- action that must be executed when the asynchronous action completes- Returns:
- the transformed asynchronous return value
-