Annotation Type AsynchronousNonBlocking
-
@Documented @Retention(RUNTIME) @Target({METHOD,TYPE}) @InterceptorBinding @Inherited @Experimental("second attempt at better handling of blocking/non-blocking asynchrony") public @interface AsynchronousNonBlocking
Alternative to MicroProfile Fault Tolerance's@Asynchronousfor guarding non-blocking asynchronous methods (executed on the original thread). It may only be present on methods that declare return type ofCompletionStage. Other than that, it has the same meaning as MicroProfile Fault Tolerance's@Asynchronous. More specifically:When a method marked with this annotation is called, the method call is allowed to proceed on the original thread. It is assumed that the guarded method will, at some point, perform some non-blocking asynchronous operation(s), such as non-blocking IO, and that it synchronously returns a
CompletionStage. It is further assumed that the completion of the asynchronos non-blocking operation(s) executed by the guarded method is followed by completion of the returnedCompletionStage.When the guarded method returns, a
CompletionStageis returned to the caller and can be used to access the result of the asynchronous execution, when it completes.Before the asynchronous execution completes, the
CompletionStagereturned to the caller is incomplete. Once the asynchronous execution completes, theCompletionStagereturned to the caller becomes equivalent to theCompletionStagereturned by the guarded method. If the guarded method synchronously throws an exception, the returnedCompletionStagecompletes with that exception.If a method marked with this annotation doesn't declare return type of
CompletionStage,FaultToleranceDefinitionExceptionoccurs during deployment.If a class is annotated with this annotation, all its methods are treated as if they were marked with this annotation. If one of the methods doesn't return
CompletionStage,FaultToleranceDefinitionExceptionoccurs during deployment.