Class StopwatchBlocks

  • All Implemented Interfaces:
    Stopwatch
    Direct Known Subclasses:
    Timekeeper

    public abstract class StopwatchBlocks
    extends java.lang.Object
    implements Stopwatch
    Default implementations of Stopwatch wrap and start.
    • Constructor Summary

      Constructors 
      Constructor Description
      StopwatchBlocks()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void activate​(java.lang.String name)
      Start a stopwatch where subsequent operations in the current asynchronous scope will propagate the stopwatch; such as within the scope of an Akka Stream operator.
      abstract void add​(java.lang.String name)  
      abstract void remove​(java.lang.String name)  
      void start​(java.lang.String name, java.lang.Runnable runnable)
      Start a stopwatch where the operations in the runnable will propagate the stopwatch.
      <T> T start​(java.lang.String name, scala.Function0<T> body)
      Start a stopwatch where the operations in the block will propagate the stopwatch.
      void wrap​(java.lang.String name, java.lang.Runnable runnable)
      Run the runnable within a stopwatch start and end, to create a user defined time interval.
      <T> T wrap​(java.lang.String name, scala.Function0<T> body)
      Run the block within a stopwatch start and stop, to create a user defined time interval.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.lightbend.cinnamon.stopwatch.Stopwatch

        stop
    • Constructor Detail

      • StopwatchBlocks

        public StopwatchBlocks()
    • Method Detail

      • activate

        public void activate​(java.lang.String name)
        Description copied from interface: Stopwatch
        Start a stopwatch where subsequent operations in the current asynchronous scope will propagate the stopwatch; such as within the scope of an Akka Stream operator. The matching stopwatch stop operation will create a user defined time interval. A user defined stopwatch may start and stop in any location in the asynchronous flow, i.e. it may span over several actors, futures, or streams.

        Specified by:
        activate in interface Stopwatch
        Parameters:
        name - name of the stopwatch
      • add

        public abstract void add​(java.lang.String name)
      • remove

        public abstract void remove​(java.lang.String name)
      • start

        public <T> T start​(java.lang.String name,
                           scala.Function0<T> body)
        Description copied from interface: Stopwatch
        Start a stopwatch where the operations in the block will propagate the stopwatch. The matching stopwatch stop operation will create a user defined time interval. A user defined stopwatch may start and stop in any location in the asynchronous flow, i.e. it may span over several actors, futures, or streams.

        Specified by:
        start in interface Stopwatch
        Type Parameters:
        T - return type of block
        Parameters:
        name - name of the stopwatch
        body - block of code to run within the stopwatch start scope
        Returns:
        result of block
      • start

        public void start​(java.lang.String name,
                          java.lang.Runnable runnable)
        Description copied from interface: Stopwatch
        Start a stopwatch where the operations in the runnable will propagate the stopwatch. The matching stopwatch stop operation will create a user defined time interval. A user defined stopwatch may start and stop in any location in the asynchronous flow, i.e. it may span over several actors, futures, or streams.

        Specified by:
        start in interface Stopwatch
        Parameters:
        name - name of the stopwatch
        runnable - runnable to run within the stopwatch start scope
      • wrap

        public <T> T wrap​(java.lang.String name,
                          scala.Function0<T> body)
        Description copied from interface: Stopwatch
        Run the block within a stopwatch start and stop, to create a user defined time interval.

        Specified by:
        wrap in interface Stopwatch
        Type Parameters:
        T - return type of block
        Parameters:
        name - name of the stopwatch
        body - block of code to run within the time interval
        Returns:
        result of block
      • wrap

        public void wrap​(java.lang.String name,
                         java.lang.Runnable runnable)
        Description copied from interface: Stopwatch
        Run the runnable within a stopwatch start and end, to create a user defined time interval.

        Specified by:
        wrap in interface Stopwatch
        Parameters:
        name - name of the stopwatch
        runnable - runnable to run within the time interval