Class RetryHelper


  • public class RetryHelper
    extends java.lang.Object
    Utility class to handle fail and retry process in case time can't be retrieved or connectivityManager is null.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void scheduleRetryUpdate​(long delay, long period)
      Schedule an update.
      void stop()
      Stops the retry.
      • Methods inherited from class java.lang.Object

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

      • RetryHelper

        public RetryHelper​(@NonNull
                           NTPService retryUpdate,
                           int period,
                           int maxAttempt)
        Instantiates a RetryHelper.
        Parameters:
        retryUpdate - the callback to be called to try updating the time.
        period - the period in milliseconds between two retry.
        maxAttempt - the max attempts (0 for infinite).
    • Method Detail

      • stop

        public void stop()
        Stops the retry.
      • scheduleRetryUpdate

        public void scheduleRetryUpdate​(long delay,
                                        long period)
        Schedule an update.
        Parameters:
        delay - delay in milliseconds before first update.
        period - period in milliseconds between successive update