jbora
Class ProcessID

java.lang.Object
  extended byjbora.ProcessID
All Implemented Interfaces:
Comparable, Serializable

public final class ProcessID
extends Object
implements Serializable, Comparable

Implements a group member identifier. A group member is identified by the string representation of its own SpreadGroup object. (m.p.) Since occasionally we need to multicast a view (an array of ProcessID objects), our ProcessID must be serializable. spread.SpreadGroup is not, so we use SpreadGroup converted to String as the member identifier. The boolean field active (is member active) has been removed. (It might be reimplemented in future releases of JBora.)

Author:
Milan Prica
See Also:
Serialized Form

Constructor Summary
ProcessID(spread.SpreadGroup mbr)
          Creates a new identifier.
 
Method Summary
 int compareTo(Object o)
          Compares the size of this object and the specified object.
 boolean equals(Object o)
          Checks if two identifiers are equal.
 InetAddress getInetAddress()
          Internet Protocol (IP) address representation of this ProcessID.
 int hashCode()
          Returns the hash code of the identifier.
 String toString()
          Returns the connection_name@host ID of a process.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessID

public ProcessID(spread.SpreadGroup mbr)
Creates a new identifier.

Parameters:
mbr - SpreadGroup object
Method Detail

equals

public boolean equals(Object o)
Checks if two identifiers are equal. Two identifiers are equal if their internal SpreadGroup objects are equal.

Parameters:
o - Identifier to compare to
Returns:
True if the two identifiers are equal

hashCode

public int hashCode()
Returns the hash code of the identifier.

Returns:
Hash code

getInetAddress

public InetAddress getInetAddress()
                           throws UnknownHostException
Internet Protocol (IP) address representation of this ProcessID.

Returns:
InetAddress
Throws:
UnknownHostException - if no IP address for the host could be found.

toString

public String toString()
Returns the connection_name@host ID of a process. All host name are fully qualified DNS names. Since JBora must return fully qualified DNS names while Spread appears to not use such form (e.g., member names in Spread are of the form someMember#someHost whereas we need someMember#someHost.someDomain), the implementation of this class has to map an host name to the corresponding fully qualified form. Warning! On some Windows systems the InetAddress.getCanonicalHostName() does not return the entire host.domain name for the localhost - the domain part is missing. (i.e. conn@MANOLETE3 is returned instead of conn@manolete3.univ.trieste.it) However, Spread does NOT appear to suffer this Windows behaviour.

Returns:
String connection@fully_qualified_DNS_host_name

compareTo

public int compareTo(Object o)
Compares the size of this object and the specified object.

Specified by:
compareTo in interface Comparable
Parameters:
o - Object to compare to
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - If the specified object's type prevents it from being compared to this Object.