Package com.hazelcast.cluster
Class Address
java.lang.Object
com.hazelcast.cluster.Address
- All Implemented Interfaces:
DataSerializable,IdentifiedDataSerializable
Represents an address of a member in the cluster.
-
Constructor Summary
ConstructorsConstructorDescriptionAddress()Address(String hostname, InetAddress inetAddress, int port) Address(InetAddress inetAddress, int port) Address(InetSocketAddress inetSocketAddress) Creates a new Address -
Method Summary
Modifier and TypeMethodDescriptionstatic AddresscreateUnresolvedAddress(String host, int port) Creates an unresolved address.booleanintReturns type identifier for this class.intReturns DataSerializableFactory factory ID for this class.getHost()intgetPort()inthashCode()booleanisIPv4()booleanisIPv6()voidReads fields from the input streamvoidsetScopeId(String scopeId) toString()voidWrites object fields to output stream
-
Constructor Details
-
Address
public Address() -
Address
- Throws:
UnknownHostException
-
Address
-
Address
Creates a new Address- Parameters:
inetSocketAddress- the InetSocketAddress to use- Throws:
NullPointerException- if inetSocketAddress is nullIllegalArgumentException- if the address can't be resolved.
-
Address
-
Address
-
-
Method Details
-
getHost
-
getPort
public int getPort() -
getInetAddress
- Throws:
UnknownHostException
-
getInetSocketAddress
- Throws:
UnknownHostException
-
isIPv4
public boolean isIPv4() -
isIPv6
public boolean isIPv6() -
getScopeId
-
setScopeId
-
getScopedHost
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryIdin interfaceIdentifiedDataSerializable- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassIdin interfaceIdentifiedDataSerializable- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializableWrites object fields to output stream- Specified by:
writeDatain interfaceDataSerializable- Parameters:
out- output- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializableReads fields from the input stream- Specified by:
readDatain interfaceDataSerializable- Parameters:
in- input- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the input stream has been closed.
-
equals
-
hashCode
public int hashCode() -
toString
-
createUnresolvedAddress
Creates an unresolved address. This API is used by the client for the case where the hostname can not be resolved. Members achieve the same thing via Serialization where we don't resolve the hostname when Address comes as Data from another member.- Parameters:
host- hostname or IP- Returns:
- an unresolved address
-