Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-3560

HDDS-3560 OMFailoverProxyProvider throws IllegalAccessError when assigning proxy with Hadoop version < 3.2

    XMLWordPrintableJSON

Details

    Description

      The method createOMProxyIfNeeded of OMFailoverProxyProvider will throw IllegalAccessError when work with hadoop version lower than 3.2.

      The following is the problem code, it want assign a proxy to `proxyInfo.proxy`.

        private void createOMProxyIfNeeded(ProxyInfo proxyInfo,
            String nodeId) {
          if (proxyInfo.proxy == null) {
            InetSocketAddress address = omProxyInfos.get(nodeId).getAddress();
            try {
              proxyInfo.proxy = createOMProxy(address);
            } catch (IOException ioe) {
              LOG.error("{} Failed to create RPC proxy to OM at {}",
                  this.getClass().getSimpleName(), address, ioe);
              throw new RuntimeException(ioe);
            }
          }
        }
      

      But, hadoop lower than 3.2, the field proxy of proxyInfo is marked as final.

      public static final class ProxyInfo<T> {
          public final T proxy;
          /*
           * The information (e.g., the IP address) of the current proxy object. It
           * provides information for debugging purposes.
           */
          public final String proxyInfo;
          ...
      }
      

      So, if we want to work around, we should catch the exception and new a ProxyInfo instance instead.

      Attachments

        Issue Links

          Activity

            People

              maobaolong Baolong Mao
              maobaolong Baolong Mao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: