org.apache.hadoop.hdfs.server.namenode.ha

## Class ConfiguredFailoverProxyProvider<T>

- java.lang.Object
- - org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider<T>
  - - org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider<T>

- All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.hadoop.io.retry.FailoverProxyProvider<T>
  Direct Known Subclasses:
    InMemoryAliasMapFailoverProxyProvider, RequestHedgingProxyProvider

      public class ConfiguredFailoverProxyProvider<T>
      extends AbstractNNFailoverProxyProvider<T>

  A FailoverProxyProvider implementation which allows one to configure multiple URIs to connect to during fail-over. A random configured address is tried first, and on a fail-over event the other addresses are tried sequentially in a random order.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider

      `AbstractNNFailoverProxyProvider.NNProxyInfo<T>`

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

      `org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<AbstractNNFailoverProxyProvider.NNProxyInfo<T>>` | `proxies`

    - ### Fields inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider

      `conf, factory, fallbackToSimpleAuth, LOG, ugi, xface`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfiguredFailoverProxyProvider(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, org.apache.hadoop.hdfs.server.namenode.ha.HAProxyFactory<T> factory)`
    `ConfiguredFailoverProxyProvider(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, org.apache.hadoop.hdfs.server.namenode.ha.HAProxyFactory<T> factory, String addressKey)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close all the proxy objects which have been opened over the lifetime of this proxy provider.
    `org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T>` | `getProxy()` Lazily initialize the RPC proxy object.
    `void` | `performFailover(T currentProxy)`
    `boolean` | `useLogicalURI()` Logical URI is required for this failover proxy provider.

    - ### Methods inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider

      `createProxyIfNeeded, getFallbackToSimpleAuth, getInterface, getProxyAddresses, getRandomOrder, setFallbackToSimpleAuth`

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

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

- - ### Field Detail

    - #### proxies

          protected final List<AbstractNNFailoverProxyProvider.NNProxyInfo<T>> proxies

  - ### Constructor Detail

    - #### ConfiguredFailoverProxyProvider

          public ConfiguredFailoverProxyProvider(org.apache.hadoop.conf.Configuration conf,
                                                 URI uri,
                                                 Class<T> xface,
                                                 org.apache.hadoop.hdfs.server.namenode.ha.HAProxyFactory<T> factory)

    - #### ConfiguredFailoverProxyProvider

          public ConfiguredFailoverProxyProvider(org.apache.hadoop.conf.Configuration conf,
                                                 URI uri,
                                                 Class<T> xface,
                                                 org.apache.hadoop.hdfs.server.namenode.ha.HAProxyFactory<T> factory,
                                                 String addressKey)

  - ### Method Detail

    - #### getProxy

          public org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T> getProxy()

      Lazily initialize the RPC proxy object.

    - #### performFailover

          public void performFailover(T currentProxy)

    - #### close

          public void close()
                     throws IOException

      Close all the proxy objects which have been opened over the lifetime of this proxy provider.
      Throws:
        `IOException`

    - #### useLogicalURI

          public boolean useLogicalURI()

      Logical URI is required for this failover proxy provider.
      Specified by:
        `useLogicalURI` in class `AbstractNNFailoverProxyProvider<T>`
      Returns:
        true if logical HA URI is used. false, if not used.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.