Class Stopwatch


  • public class Stopwatch
    extends Object
    Thread-safe wrapper over Stopwatch.

    Thread safety has been limited to the start/stop methods for now as they are the only ones that can throw an exception in an illegal state and are thus vulnerable to race conditions.

    • Method Detail

      • createStarted

        public static Stopwatch createStarted()
      • createUnstarted

        public static Stopwatch createUnstarted()
      • createStarted

        public static Stopwatch createStarted​(com.google.common.base.Ticker ticker)
      • start

        public void start()
      • stop

        public void stop()
      • reset

        public void reset()
      • restart

        public void restart()
        Invokes reset().start() on the underlying Stopwatch.
      • isRunning

        public boolean isRunning()
      • millisElapsed

        public long millisElapsed()
        Returns the milliseconds elapsed on the stopwatch.
      • hasElapsed

        public boolean hasElapsed​(org.joda.time.Duration duration)
        Checks if the given duration has already elapsed on the stopwatch.
      • hasNotElapsed

        public boolean hasNotElapsed​(org.joda.time.Duration duration)
        Checks that the given duration has not elapsed on the stopwatch. Calling this method is the same as !stopwatch.hasElapsed(duration).