Package org.wildfly.naming.client
Class ProviderEnvironment
java.lang.Object
org.wildfly.naming.client.ProviderEnvironment
Environmental information pertaining to a naming provider.
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe builder forProviderEnvironmentinstances. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoiddropFromBlocklist(URI location) Removes the specified location from the blocklist, allowing it to be used again.Get the authentication context supplier to use.Gets the blocklist for this provider.Get the list of provider URLs.voidupdateBlocklist(URI location) Adds location to blocklist, or extends it's back-off value if already present in the blocklist.
-
Field Details
-
TIME_MASK
public static final long TIME_MASK- See Also:
-
-
Method Details
-
getProviderUris
Get the list of provider URLs.- Returns:
- the list of provider URLs (not
null)
-
getBlocklist
Gets the blocklist for this provider. The map should generally not be mutated, with updates instead going throughupdateBlocklist(URI)anddropFromBlocklist(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 onTIME_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, asupdateBlocklist(URI)will update them accordingly.A simple provider implementation would perform the falling pseudo-code when selecting a destination:
URI location = ... Long timeout = env.getBlocklist().get(location); if (timeout == null || time >= (timeout & TIME_MASK)) { // blocklist entry expired!! } else { // Ignoring, still blocklisted! }- Returns:
- a concurrent map representing the blocklist
-
updateBlocklist
Adds location to blocklist, or extends it's back-off value if already present in the blocklist. Each call doubles the back-off time, as well as resets the starting time. Providers should call this method anytime a location is non-responsive.- Parameters:
location- the URI to blocklist.
-
dropFromBlocklist
Removes the specified location from the blocklist, allowing it to be used again.- Parameters:
location- the location to remove
-
getAuthenticationContextSupplier
Get the authentication context supplier to use. The default supplier simply captures the current context from the calling thread, but this behavior can be modified by establishing authentication information on the environment of the initial context or by individual naming providers.- Returns:
- the authentication context supplier to use (must not be
null)
-