Package org.wildfly.naming.client
Interface NamingProvider
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
HttpNamingProvider,RemoteNamingProvider
A provider for a single naming scheme. Each implementation of a naming provider has different characteristics.
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Close the provider.static NamingProviderGet the current naming provider being used for the current deserialization operation.default PeerIdentityGet a peer identity to use for context operations.getPeerIdentityForNaming(URI location) Get the peer identity to use for context operations for the specified location.default PeerIdentityGet a peer identity to use for context operations, retrying on failure.Get the provider environment.default <T,U, R> R performAction(BiFunction<T, U, R> function, T arg1, U arg2) Perform an action under the current naming provider.default <T,U, R, E extends Exception>
RperformExceptionAction(ExceptionBiFunction<T, U, R, E> function, T arg1, U arg2) Perform an action under the current naming provider.default <T,R> R performExceptionAction(NamingOperation<T, R> function, RetryContext contextOrNull, Name name, T param) Perform an action under the current naming provider.default voidThrows either anExhaustedDestinationsExceptionutilizing the information passed in the specifiedRetryContext, or an explicit exception mandated by the context.
-
Method Details
-
getProviderEnvironment
ProviderEnvironment getProviderEnvironment()Get the provider environment.- Returns:
- the provider environment (must not be
null)
-
getPeerIdentityForNaming
Get a peer identity to use for context operations. The identity may be fixed or it may vary, depending on the context configuration. If the provider has multiple locations, a location is randomly selected.- Returns:
- the peer identity to use (must not be
null) - Throws:
NamingException- if connecting, authenticating, or re-authenticating the peer failed
-
getPeerIdentityForNamingUsingRetry
default PeerIdentity getPeerIdentityForNamingUsingRetry(RetryContext context) throws NamingException Get a peer identity to use for context operations, retrying on failure. The identity may be fixed or it may vary, depending on the context configuration. If the provider has multiple locations, a location is randomly selected. If the retry context is null, a retry will not occur.- Parameters:
context- the retry context for storing state required when retrying- Returns:
- the peer identity to use (must not be
null) - Throws:
NamingException- if connecting, authenticating, or re-authenticating the peer failed
-
throwNoMoreDestinationsException
Throws either anExhaustedDestinationsExceptionutilizing the information passed in the specifiedRetryContext, or an explicit exception mandated by the context.- Parameters:
context- the current retry context of this invocation- Throws:
ExhaustedDestinationsException- if no explicit exception is specifiedNamingException- if explicity requiredRuntimeException- if explicity required
-
getPeerIdentityForNaming
Get the peer identity to use for context operations for the specified location. The identity may be fixed or it may vary, depending on the context configuration. The location should be from the list returned byProviderEnvironment.getProviderUris().- Parameters:
location- a location fromProviderEnvironment.getProviderUris()(must not benull)- Returns:
- the peer identity to use (must not be
null) - Throws:
NamingException- if connecting, authenticating, or re-authenticating the peer failed
-
getCurrentNamingProvider
Get the current naming provider being used for the current deserialization operation.- Returns:
- the current naming provider, or
nullif no provider-related deserialization is occurring
-
performAction
Perform an action under the current naming provider.- Type Parameters:
T- the first argument typeU- the second argument typeR- the function return type- Parameters:
function- the function to apply (must not benull)arg1- the first argumentarg2- the second argument- Returns:
- the function return value
-
performExceptionAction
default <T,U, R performExceptionActionR, E extends Exception> (ExceptionBiFunction<T, U, throws ER, E> function, T arg1, U arg2) Perform an action under the current naming provider.- Type Parameters:
T- the first argument typeU- the second argument typeR- the function return typeE- the function exception type- Parameters:
function- the function to apply (must not benull)arg1- the first argumentarg2- the second argument- Returns:
- the function return value
- Throws:
E- if the function throws an exception of the given type
-
performExceptionAction
default <T,R> R performExceptionAction(NamingOperation<T, R> function, RetryContext contextOrNull, Name name, T param) throws NamingExceptionPerform an action under the current naming provider.- Type Parameters:
T- the first argument typeR- the function return type- Parameters:
function- the function to apply (must not benull)- Returns:
- the function return value
- Throws:
NamingException
-
close
Close the provider. This method is called when the correspondingInitialContextis closed. This method should be idempotent.- Specified by:
closein interfaceAutoCloseable- Throws:
NamingException- if an error occurred while closing this provider
-