|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjgroup.relacs.config.DomainSet
public final class DomainSet
Collection class for storing information about a set of domains.
Field Summary | |
---|---|
static java.util.Comparator<Domain> |
domainComparator
Comparator to be provided to domain sets in order to order domains correctly, ignoring the number of replicas in each domain. |
Constructor Summary | |
---|---|
DomainSet()
Constructs an empty DomainSet . |
|
DomainSet(java.util.Comparator<Domain> comparator)
Constructs an empty DomainSet whose iteration order is
defined by the given comparator . |
|
DomainSet(DomainSet domains,
java.util.Comparator<Domain> comparator)
Constructs a new DomainSet containg the given domain set,
whose iteration order is defined by the given comparator . |
Method Summary | |
---|---|
boolean |
addDomain(Domain domain)
Add a new domain to this DomainSet . |
boolean |
addDomain(java.lang.String domainName,
java.lang.String mcastAdr,
int port,
int jdaemons)
Add a new domain to this DomainSet . |
void |
addListener(DomainListener listener)
|
boolean |
contains(java.net.InetAddress inetAdr)
Returns true if this domain set contains the given InetAddress . |
boolean |
containsDomain(Domain domain)
Check if the specified domain is in this DomainSet . |
Domain |
first()
Returns the first Domain in the domain set; the domain
returned is the one with the lowest replica count. |
Domain |
getDomain(Domain theDomain)
Returns the Domain object stored in this domain set
corresponding to the provided domain. |
Domain |
getDomain(java.net.InetAddress mcastAdr)
Returns the Domain object stored in this domain set
corresponding to the provided multicast InetAddress . |
Domain |
getHostDomain(java.net.InetAddress hostAdr)
Returns the Domain object stored in this domain set
corresponding to the provided host InetAddress . |
Domain |
getLargestDomain()
Returns the domain that contains the largest number of hosts. |
static Domain |
getLargestReplicaDomain(MemberId[] members)
Given a set of members, return the Domain
that contains the most members. |
int |
hashCode()
|
boolean |
isEmpty()
Returns true if this DomainSet is empty. |
java.util.Iterator<Domain> |
iterator()
Returns an iterator over the values of the DomainSet . |
boolean |
removeDomain(Domain domain)
Remove the specified domain from this DomainSet . |
void |
setComparator(java.util.Comparator<Domain> comparator)
|
int |
size()
Returns the number of domains stored in this DomainSet . |
Domain[] |
toArray()
Returns an array of domain objects, in sorted order. |
java.lang.String |
toString()
Returns a string representation of this object |
java.lang.String |
toString(boolean full)
Returns a string representation of this object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.util.Comparator<Domain> domainComparator
Constructor Detail |
---|
public DomainSet()
DomainSet
.
public DomainSet(java.util.Comparator<Domain> comparator)
DomainSet
whose iteration order is
defined by the given comparator
.
comparator
- public DomainSet(DomainSet domains, java.util.Comparator<Domain> comparator)
DomainSet
containg the given domain set,
whose iteration order is defined by the given comparator
.
domains
- comparator
- Method Detail |
---|
public void addListener(DomainListener listener)
public boolean addDomain(java.lang.String domainName, java.lang.String mcastAdr, int port, int jdaemons) throws java.net.UnknownHostException
DomainSet
.
domainName
- The domain name.mcastAdr
- The multicast address for this domain.port
- The multicast port for this domain.jdaemons
- The number of Jgroup daemons that should exist in the new domain.
DomainSet
did not already contain this domain.
java.net.UnknownHostException
- Is raised if the multicast address is not recognized.public boolean addDomain(Domain domain)
DomainSet
.
domain
- A domain object.
DomainSet
did not already contain this domain.public boolean removeDomain(Domain domain)
DomainSet
.
domain
- A domain object.
DomainSet
; false otherwise.public boolean containsDomain(Domain domain)
DomainSet
.
domain
- A domain object.
DomainSet
;
false otherwise.public boolean contains(java.net.InetAddress inetAdr)
InetAddress
.
inetAdr
-
public Domain getDomain(Domain theDomain)
Domain
object stored in this domain set
corresponding to the provided domain. If no domain matching the provided
domain is available in this domain set, null
is returned.
public Domain getDomain(java.net.InetAddress mcastAdr)
Domain
object stored in this domain set
corresponding to the provided multicast InetAddress
.
If no domain matching the provided domain is available in this
domain set, null
is returned.
java.lang.IllegalArgumentException
- if the provided InetAddress
is not a multicast address.public Domain getHostDomain(java.net.InetAddress hostAdr)
Domain
object stored in this domain set
corresponding to the provided host InetAddress
.
If no domain contains the provided host address in this domain set,
null
is returned.
hostAdr
- the host address whose domain object to return.
java.lang.IllegalArgumentException
- if the provided InetAddress
is a multicast address instead of a regular host address.public void setComparator(java.util.Comparator<Domain> comparator)
comparator
- The comparator to set.public int size()
DomainSet
.
public boolean isEmpty()
DomainSet
is empty.
public java.util.Iterator<Domain> iterator()
DomainSet
.
The values returned by the next
method call of the
iterator should be cast to Domain
.
This iterator returns the sorted order of the domains in this set.
iterator
in interface java.lang.Iterable<Domain>
Iterator
for the DomainSet
.public Domain[] toArray()
public Domain first()
Domain
in the domain set; the domain
returned is the one with the lowest replica count.
Domain
object found.
java.util.NoSuchElementException
- Raised if there are no domains in this DomainSet
.public Domain getLargestDomain()
public static Domain getLargestReplicaDomain(MemberId[] members)
Domain
that contains the most members. It is not specified which
domain is returned when more than one domain contains an
equal number of members.
members
- The members from which to find the domain.
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 full)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |