Class Pacer


  • public class Pacer
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Pacer.Context  
    • Constructor Summary

      Constructors 
      Constructor Description
      Pacer()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void debug​(java.lang.String message)  
      protected static boolean isDebugEnabled()  
      static void scheduleAtConstantPacing​(java.util.function.Consumer<java.lang.Integer> r, long pacingMs, long maxDurationInSeconds)  
      static void scheduleAtConstantPacing​(java.util.function.Consumer<java.lang.Integer> r, long pacingMs, java.util.function.Predicate<Pacer.Context> predicate)  
      static void scheduleAtConstantRate​(java.util.function.Consumer<java.lang.Integer> r, long executionsPerSecond, long maxDurationInSeconds)  
      • Methods inherited from class java.lang.Object

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

      • Pacer

        public Pacer()
    • Method Detail

      • scheduleAtConstantRate

        public static void scheduleAtConstantRate​(java.util.function.Consumer<java.lang.Integer> r,
                                                  long executionsPerSecond,
                                                  long maxDurationInSeconds)
                                           throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • scheduleAtConstantPacing

        public static void scheduleAtConstantPacing​(java.util.function.Consumer<java.lang.Integer> r,
                                                    long pacingMs,
                                                    long maxDurationInSeconds)
                                             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • scheduleAtConstantPacing

        public static void scheduleAtConstantPacing​(java.util.function.Consumer<java.lang.Integer> r,
                                                    long pacingMs,
                                                    java.util.function.Predicate<Pacer.Context> predicate)
                                             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • isDebugEnabled

        protected static boolean isDebugEnabled()
      • debug

        protected static void debug​(java.lang.String message)