Interface InvocationInstrumenter


  • public interface InvocationInstrumenter
    An interface for invocation instrumentation.
    Since:
    1.3
    • Method Detail

      • combine

        @NonNull
        static InvocationInstrumenter combine​(java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
        Combines multiple instrumenters into one.
        Parameters:
        invocationInstrumenters - instrumenters to combine
        Returns:
        new instrumenter
      • instrument

        @NonNull
        static java.lang.Runnable instrument​(@NonNull
                                             java.lang.Runnable runnable,
                                             java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
        Wraps Runnable with instrumentation invocations.
        Parameters:
        runnable - Runnable to be wrapped
        invocationInstrumenters - instrumenters to be used
        Returns:
        wrapper
      • instrument

        @NonNull
        static <V> java.util.concurrent.Callable<V> instrument​(@NonNull
                                                               java.util.concurrent.Callable<V> callable,
                                                               java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
        Wraps Callable with instrumentation invocations.
        Type Parameters:
        V - callable generic param
        Parameters:
        callable - Callable to be wrapped
        invocationInstrumenters - instrumenters to be used
        Returns:
        wrapper
      • instrument

        @NonNull
        static java.lang.Runnable instrument​(@NonNull
                                             java.lang.Runnable runnable,
                                             InvocationInstrumenter invocationInstrumenter)
        Wraps Runnable with instrumentation invocations.
        Parameters:
        runnable - Runnable to be wrapped
        invocationInstrumenter - instrumenter to be used
        Returns:
        wrapper
      • instrument

        @NonNull
        static <V> java.util.concurrent.Callable<V> instrument​(@NonNull
                                                               java.util.concurrent.Callable<V> callable,
                                                               InvocationInstrumenter invocationInstrumenter)
        Wraps Callable with instrumentation invocations.
        Type Parameters:
        V - callable generic param
        Parameters:
        callable - Callable to be wrapped
        invocationInstrumenter - instrumenter to be used
        Returns:
        wrapper
      • instrument

        static java.util.concurrent.Executor instrument​(@NonNull
                                                        java.util.concurrent.Executor executor,
                                                        @NonNull
                                                        InvocationInstrumenter invocationInstrumenter)
        Wraps the executor so that every tasks submitted to it will be executed instrumented with the given invocationInstrumenter. Execution itself will be delegated to the underlying executor, but it has to be considered that all instrumentation will be done with this very same invocationInstrumenter instance. This is especially useful when follow-up actions of a given task need to be registered, where a new instrumenter, thus a new wrapped executor instance belongs to each task.

        The returned wrapped executor be of subtype ExecutorService or ScheduledExecutorService if the input executor instance implemented those interfaces.

        Parameters:
        executor - the executor to wrap
        invocationInstrumenter - the instrumenter to be used upon task executions with the returned executor
        Returns:
        the wrapped executor