Class ExponentialBackOffSchedulingStrategy

    • Field Detail

      • DEFAULT_INITIAL_EXPIRY_IN_MILLIS

        public static final long DEFAULT_INITIAL_EXPIRY_IN_MILLIS
      • DEFAULT_MAX_EXPIRY_IN_MILLIS

        public static final long DEFAULT_MAX_EXPIRY_IN_MILLIS
      • backOffRate

        private final long backOffRate
      • initialExpiryInMillis

        private final long initialExpiryInMillis
      • maxExpiryInMillis

        private final long maxExpiryInMillis
      • executor

        private final java.util.concurrent.ScheduledExecutorService executor
    • Constructor Detail

      • ExponentialBackOffSchedulingStrategy

        public ExponentialBackOffSchedulingStrategy​(CacheConfig cacheConfig,
                                                    long backOffRate,
                                                    long initialExpiryInMillis,
                                                    long maxExpiryInMillis)
        Create a new scheduling strategy by using a fixed pool of worker threads and the given parameters to calculated the delay.
        Parameters:
        cacheConfig - the thread pool configuration to be used; not null
        backOffRate - the back off rate to be used; not negative
        initialExpiryInMillis - the initial expiry in milli seconds; not negative
        maxExpiryInMillis - the upper limit of the delay in milli seconds; not negative
        See Also:
        CacheConfig.getAsynchronousWorkersMax(), ExponentialBackOffSchedulingStrategy
      • ExponentialBackOffSchedulingStrategy

        ExponentialBackOffSchedulingStrategy​(java.util.concurrent.ScheduledExecutorService executor,
                                             long backOffRate,
                                             long initialExpiryInMillis,
                                             long maxExpiryInMillis)
    • Method Detail

      • createThreadPoolFromCacheConfig

        private static java.util.concurrent.ScheduledThreadPoolExecutor createThreadPoolFromCacheConfig​(CacheConfig cacheConfig)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • getBackOffRate

        public long getBackOffRate()
      • getInitialExpiryInMillis

        public long getInitialExpiryInMillis()
      • getMaxExpiryInMillis

        public long getMaxExpiryInMillis()
      • calculateDelayInMillis

        protected long calculateDelayInMillis​(int consecutiveFailedAttempts)
      • checkNotNull

        @Deprecated
        protected static <T> T checkNotNull​(java.lang.String parameterName,
                                            T value)
        Deprecated.
        Use Args.notNull(Object, String)
      • checkNotNegative

        @Deprecated
        protected static long checkNotNegative​(java.lang.String parameterName,
                                               long value)
        Deprecated.
        Use Args.notNegative(long, String)