public class DataLoaderDispatcherInstrumentation extends NoOpInstrumentation
Instrumentation
will dispatch
all the contained DataLoader
s when each level of the graphql
query is executed.
This allows you to use DataLoader
s in your DataFetcher
s
to optimal loading of data.DataLoader
,
DataLoaderRegistry
NoOpInstrumentation.NoOpInstrumentationContext<T>
INSTANCE
Constructor and Description |
---|
DataLoaderDispatcherInstrumentation(org.dataloader.DataLoaderRegistry dataLoaderRegistry)
You pass in a registry of N data loaders which will be
dispatched as
each level of the query executes. |
DataLoaderDispatcherInstrumentation(org.dataloader.DataLoaderRegistry dataLoaderRegistry,
DataLoaderDispatcherInstrumentationOptions options)
You pass in a registry of N data loaders which will be
dispatched as
each level of the query executes. |
Modifier and Type | Method and Description |
---|---|
InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> |
beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters)
This is called each time the
ExecutionStrategy is invoked and when the
CompletableFuture has been dispatched for the query fields the
InstrumentationContext.onEnd(Object, Throwable)
is called. |
java.util.concurrent.CompletableFuture<ExecutionResult> |
instrumentExecutionResult(ExecutionResult executionResult,
InstrumentationExecutionParameters parameters)
This is called to allow instrumentation to instrument the execution result in some way
|
beginDataFetch, beginExecution, beginField, beginFieldFetch, beginParse, beginValidation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createState, instrumentDataFetcher
public DataLoaderDispatcherInstrumentation(org.dataloader.DataLoaderRegistry dataLoaderRegistry)
dispatched
as
each level of the query executes.dataLoaderRegistry
- the registry of data loaders that will be dispatchedpublic DataLoaderDispatcherInstrumentation(org.dataloader.DataLoaderRegistry dataLoaderRegistry, DataLoaderDispatcherInstrumentationOptions options)
dispatched
as
each level of the query executes.dataLoaderRegistry
- the registry of data loaders that will be dispatchedoptions
- the options to control the behaviourpublic InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters)
Instrumentation
ExecutionStrategy
is invoked and when the
CompletableFuture
has been dispatched for the query fields the
InstrumentationContext.onEnd(Object, Throwable)
is called.
Note because the execution strategy execution is asynchronous, the query data is not guaranteed to be
completed when this step finishes. It is however a chance to dispatch side effects that might cause
asynchronous data fetching code to actually run or attach CompletableFuture handlers onto the result
via Instrumentation.beginExecutionStrategy
in interface Instrumentation
beginExecutionStrategy
in class NoOpInstrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic java.util.concurrent.CompletableFuture<ExecutionResult> instrumentExecutionResult(ExecutionResult executionResult, InstrumentationExecutionParameters parameters)
Instrumentation
executionResult
- CompletableFuture
of the result to instrumentparameters
- the parameters to this step