Package com.iizix.geo

Class HostNameRegionLocation


  • public class HostNameRegionLocation
    extends java.lang.Object
    A host name and/or IP address (IPv4 or IPv6) that has region location information. The region location information is retrieved from one of the configured service providers for this purpose in the server.
    Author:
    Christopher Mindus
    • Method Detail

      • getInfo

        public RegionLocation getInfo​(long timeout,
                                      IRegionLocationReply callback)
                               throws java.lang.InterruptedException,
                                      java.util.concurrent.TimeoutException
        Requests the region location information.

        If the request already has been requested and it has a reply, with or without error, the callback reply will not be invoked.

        Parameters:
        timeout - The timeout: zero for service provider default, negative value for indefinite waiting, otherwise a timeout in milliseconds.
        callback - The callback for asynchronous requests.
        Returns:
        The RegionInfo instance or if the request already has been retrieved, or null if request is done asynchronously and request has not yet been retrieved. The return valuecan be {@link RegionInfo#ERROR} if the request failed. If so, check the error with the
        Throws:
        java.lang.InterruptedException - If the thread was interrupted because the service provider was disposed or somebody else interrupted the thread, only if callback parameter is null.
        java.util.concurrent.TimeoutException - If a timeout occurred during synchronous wait, only if callback parameter is null.
      • getHost

        public HostNameOrAddress getHost()
        Gets the host name or IPv4/IPv6 address.
        Returns:
        The host.
      • getHostNameOrAddress

        public java.lang.String getHostNameOrAddress()
        Gets the original host name or IPv4/IPv6 address.
        Returns:
        The host name or address.
      • getAddress

        public java.net.InetAddress getAddress()
        Gets the InetAddress.
        Returns:
        The InetAddress as IPv4 or IPv6 instance.
      • toString

        public java.lang.String toString()
        Creates a string representation of the instance.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String formatted as hostName+" ("+InetAddress.getHostAddress()+')'.
      • hashCode

        public int hashCode()
        Returns the hashCode.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code.
      • equals

        public boolean equals​(java.lang.Object obj)
        Checks if two region location information object are equal.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to compare with.
        Returns:
        Equals flag.