org.jgroups.stack
Class LogicalAddress1_4
java.lang.Object
org.jgroups.stack.LogicalAddress1_4
- Address, Cloneable, Comparable, Externalizable
public class LogicalAddress1_4
extends java.lang.Object
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 (LogicalAddress1_4) remains the same.
An instance of LogicalAddress1_4 is generated by the transport protocol. Currently, only
UDP1_4 generates LogicalAddresses.
Note that host, timestamp and id are supposed to make LogicalAddress1_4 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.
- Bela Ban, Dec 23 2003
count
protected static int count
host
protected String host
multicast_addr
protected boolean multicast_addr
physical_addrs
protected ArrayList physical_addrs
List of physical addresses
timestamp
protected long timestamp
LogicalAddress1_4
public LogicalAddress1_4()
LogicalAddress1_4
public LogicalAddress1_4(String host_name,
List physical_addrs)
Use this constructor to create an instance, not the null-constructor
addPhysicalAddress
public void addPhysicalAddress(SocketAddress addr)
For internal use only ! Don't use this method !
addr
-
clone
public Object clone()
throws CloneNotSupportedException
compare
public int compare(LogicalAddress1_4 other)
Establishes an order between 2 addresses. Assumes other contains non-null IpAddress.
Excludes channel_name from comparison.
- 0 for equality, value less than 0 if smaller, greater than 0 if greater.
compareTo
public int compareTo(Object o)
implements the java.lang.Comparable interface
o
- - the Object to be compared
- a negative integer, zero, or a positive integer as this object is less than,
equal to, or greater than the specified object.
Comparable
equals
public boolean equals(Object obj)
getAdditionalData
public byte[] getAdditionalData()
Returns the additional_data.
- byte[]
getHost
public String getHost()
getPhysicalAddresses
public ArrayList getPhysicalAddresses()
Returns a copy of the list of physical addresses. Reason for the copy is that the list is not supposed
to be modified (should be immutable).
- List of physical addresses (return value maybe null)
getPrimaryPhysicalAddress
public SocketAddress getPrimaryPhysicalAddress()
getTimestamp
public long getTimestamp()
hashCode
public int hashCode()
init
protected void init(String host_name,
List physical_addrs)
isMulticastAddress
public boolean isMulticastAddress()
Checks whether this is an address that represents multiple destinations,
e.g. a class D address in the internet
- isMulticastAddress in interface Address
- true if this is a multicast address, false if it is a unicast address
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
removeAllPhysicalAddresses
public void removeAllPhysicalAddresses()
For internal use only ! Don't use this method !
removePhysicalAddress
public void removePhysicalAddress(SocketAddress addr)
For internal use only ! Don't use this method !
addr
-
setAdditionalData
public void setAdditionalData(byte[] additional_data)
Sets the additional_data.
additional_data
- The additional_data to set
setPrimaryPhysicalAddress
public void setPrimaryPhysicalAddress(SocketAddress primary_physical_addr)
toString
public String toString()
toString
public String toString(boolean print_details)
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.