public final class ProviderEnvironment extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ProviderEnvironment.Builder
The builder for
ProviderEnvironment instances. |
Modifier and Type | Field and Description |
---|---|
static long |
TIME_MASK |
Modifier and Type | Method and Description |
---|---|
void |
dropFromBlacklist(URI location)
Removes the specified location from the black-list, allowing it to be
used again.
|
Supplier<AuthenticationContext> |
getAuthenticationContextSupplier()
Get the authentication context supplier to use.
|
ConcurrentMap<URI,Long> |
getBlackList()
Gets the black-list for this provider.
|
List<URI> |
getProviderUris()
Get the list of provider URLs.
|
void |
updateBlacklist(URI location)
Adds location to black-list, or extends it's back-off value if already
present in the black list.
|
public static final long TIME_MASK
public List<URI> getProviderUris()
null
)public ConcurrentMap<URI,Long> getBlackList()
updateBlacklist(URI)
and dropFromBlacklist(URI)
.
The map is keyed by destination URI, as specified by
PROVIDER_URL
. The value is a long that loosely corresponds
to an expiration timestamp. More specifically the time portion is the
first 49 bits, retrievable using a bitwise AND on TIME_MASK
. The
remaining bits are used to store the current back-off multiplier. These
are typically not of interest to a user or provider implementor, as
updateBlacklist(URI)
will update them accordingly.
A simple provider implementation would perform the falling pseudo-code when selecting a destination:
URI location = ...
Long timeout = env.getBlackList().get(location);
if (timeout == null || time >= (timeout & TIME_MASK)) {
// Black-list entry expired!!
} else {
// Ignoring, still black-listed!
}
public void updateBlacklist(URI location)
location
- the URI to black-list.public void dropFromBlacklist(URI location)
location
- the location to removepublic Supplier<AuthenticationContext> getAuthenticationContextSupplier()
null
)Copyright © 2019 JBoss by Red Hat. All rights reserved.