class AddressPair
extends java.lang.Object
implements java.io.Serializable
The class contains two addresses, one of which represents the local node address while the other represents the address of the remote node.
By convention, the node which initiates a connection sends an INIT_STANDARD or INIT_CONVERSATION message. The node which accepts a connection processes that message and sends an INIT_REPLY message.
The member names of this class support this convention and represent addresses from the point of view of the node which sends the INIT_STANDARD or INIT_CONVERSATION message (nodeAddress represents the address of the node which sends the INIT message and remoteAddress represents the address of the node which sends the INIT_REPLY message).
Modifier and Type | Field and Description |
---|---|
private int |
nodeAddress
Stores local node address from the point of view of the node which
sends the initialization request message.
|
private int |
remoteAddress
Stores remote node address from the point of view of the node which
sends the initialization request message.
|
Constructor and Description |
---|
AddressPair()
Default constructor which instantiates an
AddressPair
object with both addresses set to 0. |
AddressPair(int node,
int remote)
Constructs an instance using two provided addresses.
|
Modifier and Type | Method and Description |
---|---|
(package private) int |
getNodeAddress()
Returns the local node address.
|
(package private) int |
getRemoteAddress()
Returns the remote node address.
|
(package private) void |
setNodeAddress(int address)
Sets the local node address.
|
(package private) void |
setRemoteAddress(int address)
Sets the remote node address.
|
(package private) void |
swapAddresses()
Convenience method to swap the local and remote addresses.
|
private int nodeAddress
private int remoteAddress
AddressPair()
AddressPair
object with both addresses set to 0.AddressPair(int node, int remote)
node
- Local node address.remote
- Remote node address.int getNodeAddress()
int getRemoteAddress()
void setNodeAddress(int address)
address
- Address which will be set as the local node address.void setRemoteAddress(int address)
address
- Address which will be set as the remote node address.void swapAddresses()