jgroup
Interface MemberId
- public interface MemberId
Instances of this class uniquely identify a member object
in a group.
A member identifier is composed by three parts:
- an IP address, uniquely identifying the machine
hosting the member;
- the incarnation time of the Jgroup subsystem hosting the member,
i.e. the time at which the Jgroup subsystem has been created;
- a member counter, which is used to distinguish
multiple members running in the same Java virtual machine.
When created, a Jgroup subsytem takes control over some UDP
communication port. Given the UDP specification, it is impossible
that two Jgroup subsystem share the same port in the same machine.
In this way, it is possible to discover if a remote Jgroup subsystem
has crashed and then recovered; in this case, in fact, their
incarnation times differ (the more recent is greater than the
older).
When a member id is created, its IP address and its incarnation time
are set equal to each member id created in that Java virtual machine.
So, the identifiers of members hosted in the same Java virtual machine
differs only for the member counter.
Member ids may be compared in the following ways:
- two members ids are equal (method equals) if and only
if they have the same IP address, the same incarnation time and the
same member counter;
- two members ids are neighbour (method isNeighbour)
if and only if they have the same IP address and the same incarnation
time; i.e., if they are hosted in the same virtual machine;
- a member id is newer of another member id (method
isNewer) if and only if their IP addresses are the same and
the incarnation time of the former id is greater than the incarnation
time of the latter id; in other words, if the Java virtual machine
hosting the latter member id has crashed (freeing the control over the
UDP port) and then recovered.
- Since:
- Jgroup 0.9
- Author:
- Alberto Montresor
Method Summary |
java.net.InetAddress |
getAddress()
Returns the IP address of the java virtual machine hosting
this member. |
int |
getCounter()
Returns an integer used to distinguish this particular
member from other members of the same group hosted in
the same Java virtual machine. |
boolean |
isNeighbour(MemberId id)
Returns true if and only if this member id and the specified member id
have the same IP address and the same incarnation time; i.e., if they
are hosted in the same virtual machine. |
boolean |
isNewer(MemberId id)
Returns true if and only if the IP addresses of this member id and
the specified id are the same, and the incarnation time of the former
is greater than the incarnation time of the latter; in other words,
if the Java virtual machine hosting the specified member id has crashed
and then recovered. |
getAddress
public java.net.InetAddress getAddress()
- Returns the IP address of the java virtual machine hosting
this member.
getCounter
public int getCounter()
- Returns an integer used to distinguish this particular
member from other members of the same group hosted in
the same Java virtual machine.
isNewer
public boolean isNewer(MemberId id)
- Returns true if and only if the IP addresses of this member id and
the specified id are the same, and the incarnation time of the former
is greater than the incarnation time of the latter; in other words,
if the Java virtual machine hosting the specified member id has crashed
and then recovered.
isNeighbour
public boolean isNeighbour(MemberId id)
- Returns true if and only if this member id and the specified member id
have the same IP address and the same incarnation time; i.e., if they
are hosted in the same virtual machine.