public class LoadBalancerExecutor extends LoadBalancerContext
RetryHandler, it will also retry on one or more different servers.clientName, defaultRetryHandler, maxAutoRetries, maxAutoRetriesNextServer, okToRetryOnAllOperations, vipAddresses| Constructor and Description |
|---|
LoadBalancerExecutor(ILoadBalancer lb) |
LoadBalancerExecutor(ILoadBalancer lb,
com.netflix.client.config.IClientConfig clientConfig) |
LoadBalancerExecutor(ILoadBalancer lb,
com.netflix.client.config.IClientConfig clientConfig,
com.netflix.client.RetryHandler defaultRetryHandler) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> T |
create(LoadBalancerCommand<T> command,
java.net.URI loadBalancerURI,
com.netflix.client.RetryHandler retryHandler,
java.lang.Object loadBalancerKey)
Execute a task on a server chosen by load balancer with possible retries.
|
<T> rx.Observable<T> |
create(LoadBalancerObservableCommand<T> observableCommand)
Create an
Observable that once subscribed execute network call asynchronously with a server chosen by load balancer. |
<T> rx.Observable<T> |
create(LoadBalancerObservableCommand<T> observableCommand,
com.netflix.client.RetryHandler retryHandler)
Create an
Observable that once subscribed execute network call asynchronously with a server chosen by load balancer. |
protected <T> rx.Observable<T> |
create(LoadBalancerObservableCommand<T> observableCommand,
java.net.URI loadBalancerURI,
com.netflix.client.RetryHandler retryHandler,
java.lang.Object loadBalancerKey)
Create an
Observable that once subscribed execute network call asynchronously with a server chosen by load balancer. |
<T> T |
execute(LoadBalancerCommand<T> command)
Execute a task on a server chosen by load balancer with possible retries.
|
<T> T |
execute(LoadBalancerCommand<T> command,
com.netflix.client.RetryHandler retryHandler)
Execute a task on a server chosen by load balancer with possible retries.
|
<T> rx.Observable<T> |
retryWithSameServer(Server server,
rx.Observable<T> forServer,
com.netflix.client.RetryHandler errorHandler)
Gets the
Observable that represents the result of executing on a server, after possible retries as dictated by
RetryHandler. |
deriveHostAndPortFromVipAddress, deriveSchemeAndPortFromPartialUri, generateNIWSException, getClientName, getDeepestCause, getDefaultPortFromScheme, getExecuteTracer, getLoadBalancer, getMaxAutoRetries, getMaxAutoRetriesNextServer, getNumberRetriesOnSameServer, getRetriesNextServer, getRetryHandler, getServerFromLoadBalancer, getServerStats, handleSameServerRetry, initWithNiwsConfig, isOkToRetryOnAllOperations, noteError, noteOpenConnection, noteRequestCompletion, noteRequestCompletion, noteResponse, reconstructURIWithServer, setLoadBalancer, setMaxAutoRetries, setMaxAutoRetriesNextServer, setOkToRetryOnAllOperations, setRetryHandlerpublic LoadBalancerExecutor(ILoadBalancer lb)
public LoadBalancerExecutor(ILoadBalancer lb, com.netflix.client.config.IClientConfig clientConfig)
public LoadBalancerExecutor(ILoadBalancer lb, com.netflix.client.config.IClientConfig clientConfig, com.netflix.client.RetryHandler defaultRetryHandler)
public <T> T execute(LoadBalancerCommand<T> command, com.netflix.client.RetryHandler retryHandler) throws java.lang.Exception
RetryHandler, they will be consumed internally. If number of retries has
exceeds the maximal allowed, a final error will be thrown. Otherwise, the first successful
result during execution and retries will be returned.command - interface that provides the logic to execute network call synchronously with a given Serverjava.lang.Exception - If any exception happens in the exceptionpublic <T> T execute(LoadBalancerCommand<T> command) throws java.lang.Exception
RetryHandler, they will be consumed internally. If number of retries has
exceeds the maximal allowed, a final error will be thrown. Otherwise, the first successful
result during execution and retries will be returned.command - interface that provides the logic to execute network call synchronously with a given Serverjava.lang.Exception - If any exception happens in the exceptionprotected <T> T create(LoadBalancerCommand<T> command, @Nullable java.net.URI loadBalancerURI, @Nullable com.netflix.client.RetryHandler retryHandler, @Nullable java.lang.Object loadBalancerKey) throws java.lang.Exception
RetryHandler, they will be consumed internally. If number of retries has
exceeds the maximal allowed, a final error will be thrown. Otherwise, the first successful
result during execution and retries will be returned.command - interface that provides the logic to execute network call synchronously with a given ServerloadBalancerURI - An optional URI that may contain a real host name and port to use as a fallback to the LoadBalancerExecutor
if it does not have a load balancer or cannot find a server from its server list. For example, the URI contains
"www.google.com:80" will force the LoadBalancerExecutor to use www.google.com:80 as the actual server to
carry out the retry execution. See LoadBalancerContext.getServerFromLoadBalancer(URI, Object)retryHandler - an optional handler to determine the retry logic of the LoadBalancerExecutor. If null, the default RetryHandler
of this LoadBalancerExecutor will be used.loadBalancerKey - An optional key passed to the load balancer to determine which server to return.java.lang.Exception - If any exception happens in the exceptionpublic <T> rx.Observable<T> create(LoadBalancerObservableCommand<T> observableCommand, @Nullable com.netflix.client.RetryHandler retryHandler)
Observable that once subscribed execute network call asynchronously with a server chosen by load balancer.
If there are any errors that are indicated as retriable by the RetryHandler, they will be consumed internally by the
function and will not be observed by the Observer subscribed to the returned Observable. If number of retries has
exceeds the maximal allowed, a final error will be emitted by the returned Observable. Otherwise, the first successful
result during execution and retries will be emitted.observableCommand - interface that provides the logic to execute network call asynchronously with a given ServerretryHandler - an optional handler to determine the retry logic of the LoadBalancerExecutor. If null, the default RetryHandler
of this LoadBalancerExecutor will be used.public <T> rx.Observable<T> create(LoadBalancerObservableCommand<T> observableCommand)
Observable that once subscribed execute network call asynchronously with a server chosen by load balancer.
If there are any errors that are indicated as retriable by the RetryHandler, they will be consumed internally by the
function and will not be observed by the Observer subscribed to the returned Observable. If number of retries has
exceeds the maximal allowed, a final error will be emitted by the returned Observable. Otherwise, the first successful
result during execution and retries will be emitted.observableCommand - interface that provides the logic to execute network call synchronously with a given Serverprotected <T> rx.Observable<T> create(LoadBalancerObservableCommand<T> observableCommand, @Nullable java.net.URI loadBalancerURI, @Nullable com.netflix.client.RetryHandler retryHandler, @Nullable java.lang.Object loadBalancerKey)
Observable that once subscribed execute network call asynchronously with a server chosen by load balancer.
If there are any errors that are indicated as retriable by the RetryHandler, they will be consumed internally by the
function and will not be observed by the Observer subscribed to the returned Observable. If number of retries has
exceeds the maximal allowed, a final error will be emitted by the returned Observable. Otherwise, the first successful
result during execution and retries will be emitted.observableCommand - interface that provides the logic to execute network call asynchronously with a given ServerloadBalancerURI - An optional URI that may contain a real host name and port to be used by LoadBalancerExecutor
if it does not have a load balancer or cannot find a server from its server list. For example, the URI contains
"www.google.com:80" will force the LoadBalancerExecutor to use www.google.com:80 as the actual server to
carry out the retry execution. See LoadBalancerContext.getServerFromLoadBalancer(URI, Object)retryHandler - an optional handler to determine the retry logic of the LoadBalancerExecutor. If null, the default RetryHandler
of this LoadBalancerExecutor will be used.loadBalancerKey - An optional key passed to the load balancer to determine which server to return.public <T> rx.Observable<T> retryWithSameServer(Server server, rx.Observable<T> forServer, com.netflix.client.RetryHandler errorHandler)
Observable that represents the result of executing on a server, after possible retries as dictated by
RetryHandler. During retry, any errors that are retriable are consumed by the function and will not be observed
by the external Observer. If number of retries exceeds the maximal retries allowed on one server, a final error will
be emitted by the returned Observable.forServer - A lazy Observable that does not start execution until it is subscribed to