Interface BackoffStrategy

  • All Known Implementing Classes:
    ExponentialBackoffStrategy

    public interface BackoffStrategy

    Provides a way to define a back off between fetch and lock requests.

    Note: Since an implementation of this interface may be executed by multiple threads, it is recommended to implement the custom backoff strategy in a thread-safe manner.

    Author:
    Nikola Koevski
    • Method Detail

      • reconfigure

        void reconfigure​(java.util.List<ExternalTask> externalTasks)

        Reconfigures the back off strategy based on the fetched external tasks and is invoked before calculateBackoffTime().

        The implementation might count the amount of invocations and realize a strategy reset.

        Parameters:
        externalTasks - which have been fetched
      • calculateBackoffTime

        long calculateBackoffTime()

        Calculates the back off time and is invoked after reconfigure(List).

        Returns:
        the back off time between fetch and lock requests in milliseconds