Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-16603

Improve DatanodeHttpServer With Netty recommended method

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      When reading the code, I found that some usage methods are outdated due to the upgrade of netty components.

      1.DatanodeHttpServer#Constructor

      @Deprecated
      public static final ChannelOption<Integer> WRITE_BUFFER_HIGH_WATER_MARK = valueOf("WRITE_BUFFER_HIGH_WATER_MARK"); 
      Deprecated. Use WRITE_BUFFER_WATER_MARK
      
      @Deprecated
      public static final ChannelOption<Integer> WRITE_BUFFER_LOW_WATER_MARK = valueOf("WRITE_BUFFER_LOW_WATER_MARK");
      Deprecated. Use WRITE_BUFFER_WATER_MARK
      -----
      
      this.httpServer.childOption(
                ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK,
                conf.getInt(
                    DFSConfigKeys.DFS_WEBHDFS_NETTY_HIGH_WATERMARK,
                    DFSConfigKeys.DFS_WEBHDFS_NETTY_HIGH_WATERMARK_DEFAULT));
      
      this.httpServer.childOption(
                ChannelOption.WRITE_BUFFER_LOW_WATER_MARK,
                conf.getInt(
                    DFSConfigKeys.DFS_WEBHDFS_NETTY_LOW_WATERMARK,
                    DFSConfigKeys.DFS_WEBHDFS_NETTY_LOW_WATERMARK_DEFAULT));
      
      

      2.Duplicate code 

      ChannelFuture f = httpServer.bind(infoAddr);
      try {
       f.syncUninterruptibly();
      } catch (Throwable e) {
        if (e instanceof BindException) {
         throw NetUtils.wrapException(null, 0, infoAddr.getHostName(),
         infoAddr.getPort(), (SocketException) e);
       } else {
         throw e;
       }
      }
      httpAddress = (InetSocketAddress) f.channel().localAddress();
      LOG.info("Listening HTTP traffic on " + httpAddress);

      3.io.netty.bootstrap.ChannelFactory Deprecated

      use io.netty.channel.ChannelFactory instead.

      /** @deprecated */
      @Deprecated
      public interface ChannelFactory<T extends Channel> {
          T newChannel();
      }

      Attachments

        Issue Links

          Activity

            People

              slfan1989 Shilun Fan
              slfan1989 Shilun Fan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m