Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-8773

Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Connection :

          public String getHostAddress() {
            return hostAddress;
          }
      

      Inet4Address :

          public String getHostAddress() {
      	return numericToTextFormat(getAddress());
          }
          public byte[] getAddress() {
      	byte[] addr = new byte[INADDRSZ];
      
      	addr[0] = (byte) ((address >>> 24) & 0xFF);
      	addr[1] = (byte) ((address >>> 16) & 0xFF);
      	addr[2] = (byte) ((address >>> 8) & 0xFF);
      	addr[3] = (byte) (address & 0xFF);
      	return addr;
          }
          static String numericToTextFormat(byte[] src)
          {
      	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
          }
      

      Attachments

        1. HADOOP-8773.patch
          0.6 kB
          Lijin Bin

        Issue Links

          Activity

            People

              Unassigned Unassigned
              binlijin Lijin Bin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: