BaseUrlExclusionList
@UnstableApi
public final class BaseUrlExclusionList
Holds the state of excluded base URLs to be used to select a base URL based on these exclusions.
Summary
Public constructors |
|---|
|
Creates an instance. |
Public methods |
|
|---|---|
void |
Excludes the given base URL. |
static int |
getPriorityCount(List<BaseUrl> baseUrls)Returns the number of priority levels of the given list of base URLs. |
int |
getPriorityCountAfterExclusion(List<BaseUrl> baseUrls)Returns the number of priority levels for the given list of base URLs after exclusion. |
void |
reset()Resets the state. |
@Nullable BaseUrl |
selectBaseUrl(List<BaseUrl> baseUrls)Selects the base URL to use from the given list. |
Public constructors
Public methods
exclude
public void exclude(BaseUrl baseUrlToExclude, long exclusionDurationMs)
Excludes the given base URL.
| Parameters | |
|---|---|
BaseUrl baseUrlToExclude |
The base URL to exclude. |
long exclusionDurationMs |
The duration of exclusion, in milliseconds. |
getPriorityCount
public static int getPriorityCount(List<BaseUrl> baseUrls)
Returns the number of priority levels of the given list of base URLs.
| Returns | |
|---|---|
int |
The number of priority levels before exclusion. |
getPriorityCountAfterExclusion
public int getPriorityCountAfterExclusion(List<BaseUrl> baseUrls)
Returns the number of priority levels for the given list of base URLs after exclusion.
| Returns | |
|---|---|
int |
The number of priority levels after exclusion. |
selectBaseUrl
public @Nullable 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. The base URL to use is then selected from the remaining base URLs by priority and weight.