|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.stack.LogicalAddress
public class LogicalAddress
Logical address that spans the lifetime of a member. Assigned at member (JVM) startup, and
retained until member is shutdown. Note that the address does not change on
disconnect-connect sequences. For example, when a member is shunned and subsequently
readmitted to the group, the member's address (LogicalAddress) remains the same.
An instance of LogicalAddress is generated by the transport protocol. Currently, only
UDP_NIO generates LogicalAddresses.
Note that host, timestamp and id are supposed to make LogicalAddress as unique as possible.
However, there is a remote chance that 2 instances started on the same machine create their
address at exactly the same time, resulting in identical addresses (leading to problems).
In the future, I will try to make this totally unique, by for example using the PID of the current
process (once available though the JDK, or by locking on a common resource (e.g. /dev/random)
to serialize creation. However, as for now, chances are you will never experience this problem.
Field Summary | |
---|---|
protected static int |
count
|
protected java.lang.String |
host
|
protected int |
id
|
protected boolean |
multicast_addr
|
protected java.util.ArrayList |
physical_addrs
List |
protected long |
timestamp
|
Constructor Summary | |
---|---|
LogicalAddress()
|
|
LogicalAddress(java.lang.String host_name,
java.util.List physical_addrs)
Use this constructor to create an instance, not the null-constructor |
Method Summary | |
---|---|
void |
addPhysicalAddress(java.net.SocketAddress addr)
For internal use only. |
java.lang.Object |
clone()
|
int |
compare(LogicalAddress other)
Establishes an order between 2 addresses. |
int |
compareTo(java.lang.Object o)
implements the java.lang.Comparable interface |
LogicalAddress |
copy()
|
boolean |
equals(java.lang.Object obj)
|
byte[] |
getAdditionalData()
Returns the additional_data. |
java.lang.String |
getHost()
|
long |
getId()
|
java.util.ArrayList |
getPhysicalAddresses()
Returns a copy of the list of physical addresses. |
java.net.SocketAddress |
getPrimaryPhysicalAddress()
|
long |
getTimestamp()
|
int |
hashCode()
|
protected void |
init(java.lang.String host_name,
java.util.List physical_addrs)
|
boolean |
isMulticastAddress()
Checks whether this is an address that represents multiple destinations; e.g., a class D address in the Internet. |
void |
readExternal(java.io.ObjectInput in)
|
void |
readFrom(java.io.DataInputStream in)
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed |
void |
removeAllPhysicalAddresses()
For internal use only. |
void |
removePhysicalAddress(java.net.SocketAddress addr)
For internal use only. |
void |
setAdditionalData(byte[] additional_data)
Sets the additional_data. |
void |
setPrimaryPhysicalAddress(java.net.SocketAddress primary_physical_addr)
|
int |
size()
Returns serialized size of this address |
java.lang.String |
toString()
|
java.lang.String |
toString(boolean print_details)
|
void |
writeExternal(java.io.ObjectOutput out)
|
void |
writeTo(java.io.DataOutputStream out)
Write the entire state of the current object (including superclasses) to outstream. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static int count
protected java.lang.String host
protected long timestamp
protected int id
protected boolean multicast_addr
protected java.util.ArrayList physical_addrs
Constructor Detail |
---|
public LogicalAddress()
public LogicalAddress(java.lang.String host_name, java.util.List physical_addrs)
Method Detail |
---|
protected void init(java.lang.String host_name, java.util.List physical_addrs)
public java.lang.String getHost()
public long getTimestamp()
public long getId()
public java.net.SocketAddress getPrimaryPhysicalAddress()
public void setPrimaryPhysicalAddress(java.net.SocketAddress primary_physical_addr)
public java.util.ArrayList getPhysicalAddresses()
public void addPhysicalAddress(java.net.SocketAddress addr)
addr
- public void removePhysicalAddress(java.net.SocketAddress addr)
addr
- public void removeAllPhysicalAddresses()
public boolean isMulticastAddress()
Address
isMulticastAddress
in interface Address
public int size()
Address
size
in interface Address
public byte[] getAdditionalData()
public void setAdditionalData(byte[] additional_data)
additional_data
- The additional_data to setpublic int compare(LogicalAddress other)
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- - the Object to be compared
java.lang.ClassCastException
- - if the specified object's type prevents it
from being compared to this Object.Comparable
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean print_details)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeTo(java.io.DataOutputStream out) throws java.io.IOException
Streamable
writeTo
in interface Streamable
java.io.IOException
public void readFrom(java.io.DataInputStream in) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.InstantiationException
Streamable
readFrom
in interface Streamable
java.io.IOException
java.lang.IllegalAccessException
java.lang.InstantiationException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public LogicalAddress copy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |