Interface AsyncInvocationInterceptor
-
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 thenewInterceptor
method of all registeredAsyncInvocationInterceptorFactory
providers. The MP Rest Client implementation runtime will invoke thepre
method on the main thread prior to returning execution back to the calling method of the client interface. The runtime will invoke theprepareContext
method on the invocation thread before the client request is sent. TheprepareContext
method should always be invoked before theapplyContext
method is invoked, but due to the nature of multithreading, it is possible thatapplyContext
method may be invoked before theprepareContext
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 theAsyncInvocationInterceptor
are invoked are determined by the priority of theAsyncInvocationInterceptorFactory
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
applyContext()
This method will be invoked by the MP Rest Client runtime on the "async" thread (i.e. the thread used to actually invoke the remote service and wait for the response) prior to sending the request.void
prepareContext()
This method will be invoked by the MP Rest Client runtime on the "main" thread (i.e. the thread calling the async Rest Client interface method) prior to returning control to the calling method.void
removeContext()
This method will be invoked by the MP Rest Client runtime on the "async" thread (i.e. the thread used to actually invoke the remote service and wait for the response) after all providers on the inbound response flow have been invoked.
-
-
-
Method Detail
-
prepareContext
void prepareContext()
This method will be invoked by the MP Rest Client runtime on the "main" thread (i.e. the thread calling the async Rest Client interface method) prior to returning control to the calling method.
-
applyContext
void applyContext()
This method will be invoked by the MP Rest Client runtime on the "async" thread (i.e. the thread used to actually invoke the remote service and wait for the response) prior to sending the request.
-
removeContext
void removeContext()
This method will be invoked by the MP Rest Client runtime on the "async" thread (i.e. the thread used to actually invoke the remote service and wait for the response) after all providers on the inbound response flow have been invoked.- Since:
- 1.2
-
-