Class BaseUrlExclusionList


  • public final class BaseUrlExclusionList
    extends Object
    Holds the state of excluded base URLs to be used to select a base URL based on these exclusions.
    • Constructor Detail

      • BaseUrlExclusionList

        public BaseUrlExclusionList()
        Creates an instance.
    • Method Detail

      • exclude

        public void exclude​(BaseUrl baseUrlToExclude,
                            long exclusionDurationMs)
        Excludes the given base URL.
        Parameters:
        baseUrlToExclude - The base URL to exclude.
        exclusionDurationMs - The duration of exclusion, in milliseconds.
      • selectBaseUrl

        @Nullable
        public BaseUrl selectBaseUrl​(List<BaseUrl> baseUrls)
        Selects the base URL to use from the given list.

        The list is reduced by service location and priority of base URLs that have been passed to exclude(BaseUrl, long). The base URL to use is then selected from the remaining base URLs by priority and weight.

        Parameters:
        baseUrls - The list of base URLs to select from.
        Returns:
        The selected base URL after exclusion or null if all elements have been excluded.
      • getPriorityCountAfterExclusion

        public int getPriorityCountAfterExclusion​(List<BaseUrl> baseUrls)
        Returns the number of priority levels for the given list of base URLs after exclusion.
        Parameters:
        baseUrls - The list of base URLs.
        Returns:
        The number of priority levels after exclusion.
      • getPriorityCount

        public static int getPriorityCount​(List<BaseUrl> baseUrls)
        Returns the number of priority levels of the given list of base URLs.
        Parameters:
        baseUrls - The list of base URLs.
        Returns:
        The number of priority levels before exclusion.
      • reset

        public void reset()
        Resets the state.