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
ConstructorDescriptionAddress()
Address
(String hostname, InetAddress inetAddress, int port) Address
(InetAddress inetAddress, int port) Address
(InetSocketAddress inetSocketAddress) Creates a new Address -
Method Summary
Modifier and TypeMethodDescriptionstatic Address
createUnresolvedAddress
(String host, int port) Creates an unresolved address.boolean
int
Returns type identifier for this class.int
Returns DataSerializableFactory factory ID for this class.getHost()
int
getPort()
int
hashCode()
boolean
isIPv4()
boolean
isIPv6()
void
Reads fields from the input streamvoid
setScopeId
(String scopeId) toString()
void
Writes 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:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryId
in interfaceIdentifiedDataSerializable
- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializable
Returns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassId
in interfaceIdentifiedDataSerializable
- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializable
Writes object fields to output stream- Specified by:
writeData
in interfaceDataSerializable
- Parameters:
out
- output- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializable
Reads fields from the input stream- Specified by:
readData
in interfaceDataSerializable
- Parameters:
in
- input- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may 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 IPport
- port- Returns:
- an unresolved address
-