Package com.iizix.geo
Class HostNameRegionLocation
- java.lang.Object
- com.iizix.geo.HostNameRegionLocation
public class HostNameRegionLocation extends java.lang.ObjectA 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Checks if two region location information object are equal.java.net.InetAddressgetAddress()Gets the InetAddress.HostNameOrAddressgetHost()Gets the host name or IPv4/IPv6 address.java.lang.StringgetHostNameOrAddress()Gets the original host name or IPv4/IPv6 address.RegionLocationgetInfo(long timeout, IRegionLocationReply callback)Requests the region location information.inthashCode()Returns the hashCode.java.lang.StringtoString()Creates a string representation of the instance.
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
replywill 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
nullif 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 ifcallbackparameter isnull.java.util.concurrent.TimeoutException- If a timeout occurred during synchronous wait, only ifcallbackparameter isnull.
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:
toStringin classjava.lang.Object- Returns:
- A String formatted as
hostName+" ("+InetAddress.getHostAddress()+')'.
hashCode
public int hashCode()
Returns the hashCode.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code.
equals
public boolean equals(java.lang.Object obj)
Checks if two region location information object are equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare with.- Returns:
- Equals flag.