DefaultFailoverProxyProvider (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.io.retry, class: DefaultFailoverProxyProvider

Package org.apache.hadoop.io.retry

# Class DefaultFailoverProxyProvider<T>

java.lang.Object
org.apache.hadoop.io.retry.DefaultFailoverProxyProvider<T>

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `FailoverProxyProvider<T>`

@Evolving public class DefaultFailoverProxyProvider<T> extends Object implements FailoverProxyProvider<T>
An implementation of `FailoverProxyProvider` which does nothing in the event of failover, and always returns the same proxy object.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.apache.hadoop.io.retry.FailoverProxyProvider

  `FailoverProxyProvider.ProxyInfo<T>`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultFailoverProxyProvider(Class<T> iface, T proxy)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `Class<T>`
  `getInterface()`
  Return a reference to the interface this provider's proxy objects actually implement.
  `FailoverProxyProvider.ProxyInfo<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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultFailoverProxyProvider

    public DefaultFailoverProxyProvider(Class<T> iface, T proxy)

- ## Method Details

  - ### getInterface

    public Class<T> getInterface()
    Description copied from interface: `FailoverProxyProvider`
    Return a reference to the interface this provider's proxy objects actually implement. If any of the methods on this interface are annotated as being `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.
    Specified by:
      `getInterface` in interface `FailoverProxyProvider<T>`
    Returns:
      the interface implemented by the proxy objects returned by `FailoverProxyProvider.getProxy()`

  - ### getProxy

    public FailoverProxyProvider.ProxyInfo<T> getProxy()
    Description copied from interface: `FailoverProxyProvider`
    Get the proxy object which should be used until the next failover event occurs.
    Specified by:
      `getProxy` in interface `FailoverProxyProvider<T>`
    Returns:
      the proxy object to invoke methods upon

  - ### performFailover

    public void performFailover(T currentProxy)
    Description copied from interface: `FailoverProxyProvider`
    Called whenever the associated `RetryPolicy` determines that an error warrants failing over.
    Specified by:
      `performFailover` in interface `FailoverProxyProvider<T>`
    Parameters:
      `currentProxy` - the proxy object which was being used before this failover event

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`