@InterfaceStability.Evolving public class DefaultFailoverProxyProvider<T> extends Object implements FailoverProxyProvider<T>
FailoverProxyProvider
which does nothing in the
event of failover, and always returns the same proxy object.Constructor and Description |
---|
DefaultFailoverProxyProvider(Class<T> iface,
T proxy) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Class<T> |
getInterface()
Return a reference to the interface this provider's proxy objects actually
implement.
|
T |
getProxy()
Get the proxy object which should be used until the next failover event
occurs.
|
void |
performFailover(T currentProxy)
Called whenever the associated
RetryPolicy determines that an error
warrants failing over. |
public Class<T> getInterface()
FailoverProxyProvider
Idempotent
or AtMostOnce
, then this fact will be passed to
the RetryPolicy.shouldRetry(Exception, int, int, boolean)
method on
error, for use in determining whether or not failover should be attempted.getInterface
in interface FailoverProxyProvider<T>
FailoverProxyProvider.getProxy()
public T getProxy()
FailoverProxyProvider
getProxy
in interface FailoverProxyProvider<T>
public void performFailover(T currentProxy)
FailoverProxyProvider
RetryPolicy
determines that an error
warrants failing over.performFailover
in interface FailoverProxyProvider<T>
currentProxy
- the proxy object which was being used before this
failover eventpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2013 Apache Software Foundation. All rights reserved.