Class FixedPollInterval

  • All Implemented Interfaces:
    PollInterval

    public class FixedPollInterval
    extends java.lang.Object
    implements PollInterval
    Generates a fixed (linear) poll interval based on the supplied duration
    • Field Detail

      • duration

        private final java.time.Duration duration
    • Constructor Detail

      • FixedPollInterval

        public FixedPollInterval​(java.time.Duration duration)
        Create a new instance of the FixedPollInterval.
        Parameters:
        duration - The duration of the poll interval
      • FixedPollInterval

        public FixedPollInterval​(long pollInterval,
                                 java.util.concurrent.TimeUnit unit)
        Create a new instance of the FixedPollInterval.
        Parameters:
        pollInterval - The poll interval amount
        unit - The time unit
    • Method Detail

      • next

        public java.time.Duration next​(int pollCount,
                                       java.time.Duration previousDuration)
        Generate the next duration
        Specified by:
        next in interface PollInterval
        Parameters:
        pollCount - The number of times the condition has been polled (evaluated)
        previousDuration - The duration of the previously returned poll interval
        Returns:
        Always return the duration that was supplied to this instance of FixedPollInterval
      • fixed

        public static FixedPollInterval fixed​(long pollInterval,
                                              java.util.concurrent.TimeUnit unit)
        Syntactic sugar for create a new instance of FixedPollInterval.
        Parameters:
        pollInterval - The poll interval amount
        unit - The chrono unit
        Returns:
        A new instance of FixedPollInterval
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object