public interface AsyncInvocationInterceptor
Implementations of this interface can intercept asynchronous method invocations. The MP Rest Client implementation
runtime will obtain instances of this interface by invoking the newInterceptor
method of all registered
AsyncInvocationInterceptorFactory
providers.
The MP Rest Client implementation runtime will invoke the pre
method on the main thread prior to
returning execution back to the calling method of the client interface. The runtime will invoke the
prepareContext
method on the invocation thread before the client request is sent. The
prepareContext
method should always be invoked before the applyContext
method is invoked,
but due to the nature of multithreading, it is possible that applyContext
method may be invoked before
the prepareContext
method has completed. Care should be taken when implementing this interface to avoid
race conditions and deadlocks.
Note that the order in which instances of the AsyncInvocationInterceptor
are invoked are determined by
the priority of the AsyncInvocationInterceptorFactory
provider.
Note that the main and secondary threads handling the request/response may be the same. It depends on how the
implementation chooses to implement the asynchronous handling.
- Since:
- 1.1