Class BookieSocketAddress


  • public class BookieSocketAddress
    extends java.lang.Object
    This is a data wrapper class that is an InetSocketAddress, it would use the hostname provided in constructors directly.

    The string representation of a BookieSocketAddress is : <hostname>:<port>

    • Field Detail

      • LEGACY_BOOKIEID_RESOLVER

        public static final BookieAddressResolver LEGACY_BOOKIEID_RESOLVER
        Simple converter from legacy BookieId to a real network address.
    • Constructor Detail

      • BookieSocketAddress

        public BookieSocketAddress​(java.lang.String hostname,
                                   int port)
      • BookieSocketAddress

        public BookieSocketAddress​(java.lang.String addr)
                            throws java.net.UnknownHostException
        Throws:
        java.net.UnknownHostException
    • Method Detail

      • getHostName

        public java.lang.String getHostName()
      • getPort

        public int getPort()
      • getSocketAddress

        public java.net.InetSocketAddress getSocketAddress()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toBookieId

        public BookieId toBookieId()
        Create a BookieID in legacy format hostname:port.
        Returns:
        the BookieID
      • createDummyBookieIdForHostname

        public static BookieId createDummyBookieIdForHostname​(java.lang.String hostname)
        Utility for Placement Policies that need to create a dummy BookieId that represents a given host.
        Parameters:
        hostname - the hostname
        Returns:
        a dummy bookie id, compatible with the BookieSocketAddress#toBookieId, with a 0 tcp port.
      • isDummyBookieIdForHostname

        public static boolean isDummyBookieIdForHostname​(BookieId bookieId)
        Tells whether a BookieId may be a dummy id.
        Parameters:
        bookieId -
        Returns:
        true if the BookieId looks like it has been generated by createDummyBookieIdForHostname(java.lang.String)