|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.loadbalancer.LoadBalancerContext
com.netflix.loadbalancer.LoadBalancerExecutor
public class LoadBalancerExecutor
Provides APIs to execute and retry tasks on a server chosen by the associated load balancer.
With appropriate RetryHandler, it will also retry on one or more different servers.
| Field Summary |
|---|
| Fields inherited from class com.netflix.loadbalancer.LoadBalancerContext |
|---|
clientName, defaultRetryHandler, maxAutoRetries, maxAutoRetriesNextServer, okToRetryOnAllOperations, vipAddresses |
| Constructor Summary | |
|---|---|
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)
|
|
| Method Summary | ||
|---|---|---|
protected
|
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. |
|
|
create(LoadBalancerObservableCommand<T> observableCommand)
Create an Observable that once subscribed execute network call asynchronously with a server chosen by load balancer. |
|
|
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
|
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. |
|
|
execute(LoadBalancerCommand<T> command)
Execute a task on a server chosen by load balancer with possible retries. |
|
|
execute(LoadBalancerCommand<T> command,
com.netflix.client.RetryHandler retryHandler)
Execute a task on a server chosen by load balancer with possible retries. |
|
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public 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)
| Method Detail |
|---|
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 Server
java.lang.Exception - If any exception happens in the exception
public <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 Server
java.lang.Exception - If any exception happens in the exception
protected <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 exception
public <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 Server
protected <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
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||