Interface DataLoaderInstrumentationContext<T>


@PublicSpi public interface DataLoaderInstrumentationContext<T>
When a DataLoaderInstrumentation.'beginXXX()' method is called then it must return a DataLoaderInstrumentationContext that will be invoked when the step is first dispatched and then when it completes. Sometimes this is effectively the same time whereas at other times it's when an asynchronous CompletableFuture completes.

This pattern of construction of an object then call back is intended to allow "timers" to be created that can instrument what has just happened or "loggers" to be called to record what has happened.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onCompleted(T result, Throwable t)
    This is invoked when the instrumentation step is fully completed.
    default void
    This is invoked when the instrumentation step is initially dispatched.
  • Method Details

    • onDispatched

      default void onDispatched()
      This is invoked when the instrumentation step is initially dispatched. Note this is NOT the same time as the DataLoaderInstrumentation`beginXXX()` starts, but rather after all the inner work has been done.
    • onCompleted

      default void onCompleted(T result, Throwable t)
      This is invoked when the instrumentation step is fully completed.
      Parameters:
      result - the result of the step (which may be null)
      t - this exception will be non-null if an exception was thrown during the step