spread
public class MembershipInfo extends java.lang.Object
SpreadMessage.isMembership()
:
if(message.isMembership() == true) System.out.println("Membership message.");
To get the MembershipInfo object from a membership message, use SpreadMessage.getMembershipInfo()
:
MembershipInfo membershipInfo = message.getMembershipInfo();
A MembershipInfo object can be used to get information on what caused the membership change (the is*() methods) and extra information about the change (the get*() methods). Which get*() methods are valid for a particular membership message depends on what caused the message.
Modifier and Type | Field and Description |
---|---|
private SpreadGroup |
group |
private GroupID |
groupID |
private SpreadGroup[] |
groups |
private java.util.Vector |
members |
private int |
serviceType |
Modifier | Constructor and Description |
---|---|
protected |
MembershipInfo(SpreadConnection connection,
int serviceType,
java.util.Vector groups,
SpreadGroup sender,
byte[] data,
boolean daemonEndianMismatch) |
Modifier and Type | Method and Description |
---|---|
SpreadGroup |
getDisconnected()
Gets the private group of the member who disconnected.
|
SpreadGroup |
getGroup()
Gets a SpreadGroup object representing the group that caused this message.
|
GroupID |
getGroupID()
Gets the GroupID for this group membership at this point in time.
|
SpreadGroup |
getJoined()
Gets the private group of the member who joined.
|
SpreadGroup |
getLeft()
Gets the private group of the member who left.
|
SpreadGroup[] |
getMembers()
Gets the private groups for all the members in the new group membership.
|
SpreadGroup[] |
getStayed()
Gets the private groups of the members who were not partitioned.
|
boolean |
isCausedByDisconnect()
Check if this message was caused by a disconnect.
|
boolean |
isCausedByJoin()
Check if this message was caused by a join.
|
boolean |
isCausedByLeave()
Check if this message was caused by a leave.
|
boolean |
isCausedByNetwork()
Check if this message was caused by a network partition.
|
boolean |
isRegularMembership()
Check if this is a regular membership message.
|
boolean |
isSelfLeave()
Check if this is a self-leave message.
|
boolean |
isTransition()
Check if this is a transition message.
|
private int serviceType
private SpreadGroup group
private GroupID groupID
private java.util.Vector members
private SpreadGroup[] groups
protected MembershipInfo(SpreadConnection connection, int serviceType, java.util.Vector groups, SpreadGroup sender, byte[] data, boolean daemonEndianMismatch)
public boolean isRegularMembership()
getGroup()
, getGroupID()
,
and getMembers()
are valid.
One of getJoined()
, getLeft()
,
getDisconnected()
, or getStayed()
are valid
depending on the type of message.getGroup()
,
getGroupID()
,
getMembers()
,
getJoined()
,
getLeft()
,
getDisconnected()
,
getStayed()
public boolean isTransition()
getGroup()
is the only valid get*() function.getGroup()
public boolean isCausedByJoin()
getJoined()
can be used to get the group member who joined.getJoined()
public boolean isCausedByLeave()
getLeft()
can be used to get the group member who left.getLeft()
public boolean isCausedByDisconnect()
getDisconnected()
can be used to get the group member who left.getDisconnected()
public boolean isCausedByNetwork()
getStayed()
can be used to get the members who are still in the group.getStayed()
public boolean isSelfLeave()
getGroup()
is the only valid get*() function.getGroup()
public SpreadGroup getGroup()
public GroupID getGroupID()
isRegularMembership()
is true.
If it is not true, null is returned.public SpreadGroup[] getMembers()
isRegularMembership()
is true.
If it is not true, null is returned.public SpreadGroup getJoined()
isRegularMembership()
and
isCausedByJoin()
are true.
If either or both are false, null is returned.isCausedByJoin()
public SpreadGroup getLeft()
isRegularMembership()
and
( isCausedByLeave()
or isCausedByDisconnect()
) are true.
If either or both are false, null is returned.MembershipInfo#isCausedByDisconnect()
public SpreadGroup getDisconnected()
isRegularMembership()
and
isCausedByDisconnect()
are true.
If either or both are false, null is returned.isCausedByDisconnect()
public SpreadGroup[] getStayed()
isRegularMembership()
and
isCausedByNetwork()
are true.
If either or both are false, null is returned.isCausedByNetwork()
Copyright © 2004 Spread Concepts LLC. All Rights Reserved.