Class Watches

  • All Implemented Interfaces:

    
    public class Watches
    
                        

    Performance Monitoring

    Since:

    2022-11-21

    Author:

    trydofor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static Logger log
    • Constructor Summary

      Constructors 
      Constructor Description
      Watches()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static StopWatch acquire() acquire and release with try-close style
      static StopWatch.Watch acquire(String name)
      static StopWatch current() Get the StopWatch at the current thread.
      static StopWatch.Watch current(String name) Get the StopWatch at the current thread.
      static boolean release(boolean clean) Release the current timer and returns whether all timers have finished.
      static boolean release(boolean clean, @Nullable() String token) Release the current timer and returns whether all timers have finished.
      static boolean release(boolean clean, @Nullable() String token, @NotNull() BiConsumer<String, StopWatch> handle) Release the current timer and returns whether all timers have finished.
      static void setWatchHandler(BiConsumer<String, StopWatch> handler) to handle the StopWatch when timings are finished and token is not null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Watches

        Watches()
    • Method Detail

      • acquire

        @NotNull() static StopWatch acquire()

        acquire and release with try-close style

      • acquire

        @NotNull() static StopWatch.Watch acquire(String name)
      • current

        @Nullable() static StopWatch current()

        Get the StopWatch at the current thread.

      • current

        @Nullable() static StopWatch.Watch current(String name)

        Get the StopWatch at the current thread.

      • release

         static boolean release(boolean clean)

        Release the current timer and returns whether all timers have finished. When all timings are finished, clear the watches if clean.

      • release

         static boolean release(boolean clean, @Nullable() String token)

        Release the current timer and returns whether all timers have finished. When all timings are finished, handle the StopWatch if token is not null, clear the watches if clean.

      • release

         static boolean release(boolean clean, @Nullable() String token, @NotNull() BiConsumer<String, StopWatch> handle)

        Release the current timer and returns whether all timers have finished. When all timings are finished, handle the StopWatch if token is not null, clear the watches if clean.

      • setWatchHandler

         static void setWatchHandler(BiConsumer<String, StopWatch> handler)

        to handle the StopWatch when timings are finished and token is not null. should handle the StopWatch before its clean.

        Parameters:
        handler - token and StopWatch are not null