org.jgroups.protocols

Class JMS.JMSAddress

Enclosing Class:
JMS
Implemented Interfaces:
Address, Cloneable, Comparable, Externalizable

protected static class JMS.JMSAddress
extends java.lang.Object
implements Address

Simple Address representing the JMS node ID or JMS topic group.

Constructor Summary

JMSAddress()
Empty constructor to allow externalization work.
JMSAddress(String str)
Reconstruct the address from the string representation.
JMSAddress(String address, boolean isMCast)
Create instance of this class for given address string.

Method Summary

protected Object
clone()
Clone the object.
int
compareTo(Object o)
Compare this object to o.
boolean
equals(Object obj)
Test is this object is equal to obj.
String
getAddress()
Get the node address.
int
hashCode()
Get the hash code of this address.
boolean
isMulticastAddress()
Is the address a multicast address?
void
readExternal(ObjectInput in)
Read object from external input.
void
setAddress(String address)
Set the node address.
String
toString()
Get the string representation of the address.
void
writeExternal(ObjectOutput out)
Write the object to external output.

Constructor Details

JMSAddress

public JMSAddress()
Empty constructor to allow externalization work.

JMSAddress

public JMSAddress(String str)
Reconstruct the address from the string representation. If the str starts with '#', address is considered as unicast, and node address is the substring after '#'. Otherwise, address is multicast and address is str itself.
Parameters:
str - string used to reconstruct the instance.

JMSAddress

public JMSAddress(String address,
                  boolean isMCast)
Parameters:
address - string representing the address of the node connected to the JMS topic, usually, a value of connection.getClientID(), where the connection is instance of javax.jms.TopicConnection.
isMCast - true if the address is multicast address, otherwise - false.

Method Details

clone

protected Object clone()
            throws CloneNotSupportedException
Clone the object.

compareTo

public int compareTo(Object o)
            throws ClassCastException
Compare this object to o. It is possible to compare only addresses of the same class. Also they both should be either multicast or unicast addresses.
Returns:
value compliant with the Comparable.compareTo(Object) specififaction.

equals

public boolean equals(Object obj)
Test is this object is equal to obj.
Returns:
true iff the obj is JMSAddress, node addresses are equal and they both are either multicast or unicast addresses.

getAddress

public String getAddress()
Get the node address.

hashCode

public int hashCode()
Get the hash code of this address.
Returns:
hash code of this object.

isMulticastAddress

public boolean isMulticastAddress()
Is the address a multicast address?
Specified by:
isMulticastAddress in interface Address
Returns:
true if the address is multicast address.

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException
Read object from external input.

setAddress

public void setAddress(String address)
Set the node address.
Parameters:
address - new node address.

toString

public String toString()
Get the string representation of the address. The following property holds: a2.equals(a1) is always true, where a2 is JMSAddress a2 = new JMSAddress(a1.toString());
Returns:
string representation of the address.

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException
Write the object to external output.

Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.