Package com.iizix.geo

Class HostNameRegionLocation

java.lang.Object
com.iizix.geo.HostNameRegionLocation

public class HostNameRegionLocation extends 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 Details

    • getInfo

      public RegionLocation getInfo(long timeout, IRegionLocationReply callback) throws InterruptedException, 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 value can be {@link RegionInfo#ERROR} if the request failed. If so, check the error with the
      Throws:
      InterruptedException - If the thread was interrupted because the service provider was disposed or somebody else interrupted the thread, only if callback parameter is null.
      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 String getHostNameOrAddress()
      Gets the original host name or IPv4/IPv6 address.
      Returns:
      The host name or address.
    • getAddress

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

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

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

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