|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgroup.relacs.config.HostSet
public final class HostSet
Collection class for storing information about a set of hosts.
| Constructor Summary | |
|---|---|
HostSet()
Constructs an empty HostSet with default capacity and
load factor. |
|
HostSet(int maxEntries)
Constructs an empty HostSet with default load factor,
with space for maxEntries elements. |
|
HostSet(int maxEntries,
float loadFactor)
Constructs an empty HostSet with space for
maxEntries elements, using the specified load factor. |
|
| Method Summary | |
|---|---|
boolean |
addHost(Host host)
Add a new host to this HostSet. |
boolean |
addHost(int hostIntAdr)
Add the given host to the this host set. |
boolean |
addHost(java.lang.String hostName,
Domain domain,
int port)
Add a new host to this HostSet. |
void |
addHostListener(HostListener listener)
|
void |
addHosts(HostSet hostSet)
Add all hosts in the given HostSet to this
HostSet. |
java.lang.Object |
clone()
Returns a shallow copy of this HostSet instance. |
boolean |
containsAll(HostSet hostSet)
Check if the given host set is fully contained in this HostSet. |
boolean |
containsHost(Host host)
Check if the host is in this HostSet. |
boolean |
containsHost(java.net.InetAddress inetAddress)
Check if the host represented by the given InetAddress is in this HostSet. |
boolean |
equals(java.lang.Object o)
|
HostSet |
getAvailHosts()
Returns the set of hosts that are considered available; i.e. |
Host |
getFirst()
Returns the first Host returned by the iterators next
method. |
Host |
getHost(java.net.InetAddress inetAddress)
Returns the Host object associated with the specified
InetAddress. |
Host |
getHost(MemberId member)
Returns the Host object associated with the specified
MemberId. |
int |
hashCode()
Return a hash code for this host set. |
boolean |
isEmpty()
Returns true if this HostSet is empty. |
java.util.Iterator<Host> |
iterator()
Returns an iterator over the values of the HostSet. |
void |
readExternal(java.io.ObjectInput in)
|
void |
removeAllHosts()
Remove all hosts in this HostSet. |
Host |
removeFirst()
Removes the first Host returned by the iterators next
method. |
boolean |
removeHost(Host host)
Remove a host from this HostSet. |
boolean |
removeHost(MemberId member)
Remove a host (member) from this HostSet. |
void |
removeHosts(HostSet hostSet)
Remove all hosts in the given HostSet from this
HostSet. |
int |
size()
Returns the number of hosts stored in this HostSet. |
Host[] |
toArray()
|
int[] |
toIntArray()
Returns an int[] array representing the content of
this HostSet. |
java.lang.String |
toString()
Returns a string representation of this object |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public HostSet()
HostSet with default capacity and
load factor. Also the default constructor for externalization.
public HostSet(int maxEntries)
HostSet with default load factor,
with space for maxEntries elements.
public HostSet(int maxEntries,
float loadFactor)
HostSet with space for
maxEntries elements, using the specified load factor.
| Method Detail |
|---|
public void addHostListener(HostListener listener)
public Host getHost(java.net.InetAddress inetAddress)
Host object associated with the specified
InetAddress.
inetAddress - The InetAddress of the Host object to get.
Host object associated with the given
InetAddress. null is returned if the given
IP address host is not in this host set.public Host getHost(MemberId member)
Host object associated with the specified
MemberId.
member - The MemberId of the Host object to get.
Host object associated with the given
MemberId. null is returned if the given
member host is not in this host set.
public boolean addHost(java.lang.String hostName,
Domain domain,
int port)
throws java.net.UnknownHostException
HostSet.
hostName - The host name.domain - The Domain associated with this host.port - The port number for this host.
HostSet did not already contain this host.
java.net.UnknownHostException - Is raised if the host was not recognized.public boolean addHost(Host host)
HostSet.
host - A host object.
HostSet did not already contain this host.
public boolean addHost(int hostIntAdr)
throws java.net.UnknownHostException
Host object in the DistributedSystemConfig
object.
hostIntAdr - An int representation of the host to add to this
host set.
HostSet did not already contain this host.
java.net.UnknownHostException - If the int representation of the host does not
correspond to a valid host address, or if it could not
be found.public void addHosts(HostSet hostSet)
HostSet to this
HostSet.
hostSet - The set of hosts to add to this host set.public boolean removeHost(MemberId member)
HostSet.
member - A member object representing a host object.
Host was removed from the
HostSet, that is if it was present in the
HostSet; false otherwise.public boolean removeHost(Host host)
HostSet.
host - A host object.
Host was removed from the
HostSet, that is if it was present in the
HostSet; false otherwise.public void removeHosts(HostSet hostSet)
HostSet from this
HostSet.
hostSet - The set of hosts to remove from this host set.public void removeAllHosts()
HostSet.
public boolean containsAll(HostSet hostSet)
HostSet.
hostSet - A host set.
HostSet is contained in
this host set.public boolean containsHost(Host host)
HostSet.
host - A host object.
HostSet contained the specified host.public boolean containsHost(java.net.InetAddress inetAddress)
HostSet.
inetAddress - The InetAddress representation of the host to
test for presence in the HostSet.
HostSet contained the specified host.public int size()
HostSet.
public boolean isEmpty()
HostSet is empty.
public java.util.Iterator<Host> iterator()
HostSet.
The values returned by the next method call of the
iterator should be cast to Host.
iterator in interface java.lang.Iterable<Host>Iterator for the HostSet.public HostSet getAvailHosts()
ExecService instance.
public Host[] toArray()
public int[] toIntArray()
int[] array representing the content of
this HostSet.
public Host getFirst()
Host returned by the iterators next
method. There is no guarantees that this method returns the same
host for multiple invocations, nor does it promise to return a
different host on the next invocation. This method is useful to
obtain just one host in the HostSet, when it does not
matter which host to get.
Host object found.
java.util.NoSuchElementException - Raised if there are no hosts in this HostSet.public Host removeFirst()
Host returned by the iterators next
method. There is no guarantees that this method returns the same
host for multiple invocations. This method is useful to
obtain just one host in the HostSet, when it does not
matter which host to get.
Host object found.
java.util.NoSuchElementException - Raised if there are no hosts in this HostSet.public java.lang.Object clone()
HostSet instance.
(The elements themselves are not copied.)
clone in class java.lang.ObjectHostSet instance.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||