Interface SpanningOperationRunner

All Known Implementing Classes:
SpanningOperationRunnerImpl

@ExperimentalApi public interface SpanningOperationRunner
Allows to execute some arbitrary code as a part of larger "spanning" operation.
Since:
7.13
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(SpanningOperation spanningOperation, Runnable runnable)
    Allows marking events generated by passed runnable with passed surroundingOperation Current implementation allows setting spanning operation for current thread only.
    <T> T
    execute(SpanningOperation spanningOperation, Supplier<T> supplier)
    Allows marking events generated by passed callable with passed surroundingOperation.
    <T> T
    executeCallable(SpanningOperation spanningOperation, Callable<T> callable)
    Allows marking events generated by passed callable with passed surroundingOperation.
  • Method Details

    • execute

      <T> T execute(@Nonnull SpanningOperation spanningOperation, @Nonnull Supplier<T> supplier)
      Allows marking events generated by passed callable with passed surroundingOperation. Current implementation allows setting spanning operation for current thread only. If some other thread is spawned in the passed callable then spanning operation has to be set up for the newly started thread. Currently only events that implement SpanningOperationEvent are affected by this method.
      Type Parameters:
      T - Type of returned object
      Parameters:
      spanningOperation - Operation that spans over passed supplier
      supplier - Set of instructions executed in the context of spanning operation
      Returns:
      value returned by passed supplier
    • execute

      void execute(@Nonnull SpanningOperation spanningOperation, @Nonnull Runnable runnable)
      Allows marking events generated by passed runnable with passed surroundingOperation Current implementation allows setting spanning operation for current thread only. If some other thread is spawned in the passed runnable then spanning operation has to be set up for the newly started thread. Currently only events that implement SpanningOperationEvent are affected by this method.
      Parameters:
      spanningOperation - Operation that spans over passed runnable
      runnable -
    • executeCallable

      <T> T executeCallable(@Nonnull SpanningOperation spanningOperation, @Nonnull Callable<T> callable)
      Allows marking events generated by passed callable with passed surroundingOperation. Current implementation allows setting spanning operation for current thread only. If some other thread is spawned in the passed callable then spanning operation has to be set up for the newly started thread. Currently only events that implement SpanningOperationEvent are affected by this method. Exceptions thrown by callable are converted to RuntimeException and re-thrown.
      Type Parameters:
      T - Type of returned object
      Parameters:
      spanningOperation - Operation that spans over passed callable
      callable - Set of instructions executed in the context of spanning operation
      Returns:
      value returned by passed callable