public abstract class ReactorContextManager extends Object
GraphQLContext
so it can be subsequently obtained and propagated to data fetchers, exception
handlers, and others.
The Reactor context is also used to carry ThreadLocal values that are also restored around the execution of data fetchers and exceptions handlers.
Constructor and Description |
---|
ReactorContextManager() |
Modifier and Type | Method and Description |
---|---|
static reactor.util.context.Context |
extractThreadLocalValues(ThreadLocalAccessor accessor,
reactor.util.context.Context context)
Use the given accessor to extract ThreadLocal values and save them in a
sub-map in the given
Context , so those can be restored later
around the execution of data fetchers and exception resolvers. |
static <T> T |
invokeCallable(Callable<T> callable,
GraphQLContext graphQlContext)
Restore
ThreadLocal values, invoke the given Callable ,
and reset the ThreadLocal values. |
public static reactor.util.context.Context extractThreadLocalValues(ThreadLocalAccessor accessor, reactor.util.context.Context context)
Context
, so those can be restored later
around the execution of data fetchers and exception resolvers. The accessor
instance is also saved in the Reactor Context, so it can be used to
actually restore and reset ThreadLocal values.accessor
- the accessor to usecontext
- the context to write to if there are ThreadLocal valuesContextView
or the Context
instance
that was passed in, if there were no ThreadLocal values to extract.public static <T> T invokeCallable(Callable<T> callable, GraphQLContext graphQlContext) throws Exception
ThreadLocal
values, invoke the given Callable
,
and reset the ThreadLocal
values.callable
- the callable to invokegraphQlContext
- the current GraphQLContext
Exception