public interface Group
A group object represents the membership or potential membership of an application process in a group.
A group server tracks group members, and assigns an ordinal to each member. The group facility raises advisories to inform the member of its current ordinal. Based on its ordinal, each member operates in a particular application-specific role.
The group server also reports the group status as members join and leave the group, or disconnect from the server. The group facility raises advisories to inform members and observers of such changes in status.
This class defines the public API of the group facility.
To join a group, call
GroupFactory.join.
| Modifier and Type | Interface and Description |
|---|---|
static class |
Group.GroupMemberEvent
Group member event; enumeration.
|
static class |
Group.GroupMemberServerConnection
Group member connection to group server; enumeration.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ADVISORY_FIELD_GROUP
Group name (field name).
|
static java.lang.String |
ADVISORY_FIELD_ORDINAL
Group member ordinal (field name).
|
static java.lang.String |
ADVISORY_MODULE_GROUP
The advisory message pertains to the group library
implementation code (module).
|
static java.lang.String |
ADVISORY_NAME_GROUP_STATUS
The advisory message reports a group status update.
|
static java.lang.String |
ADVISORY_NAME_ORDINAL_UPDATE
The advisory message reports an ordinal update.
|
static java.lang.String |
FIELD_GROUP_MEMBER_DESCRIPTOR
Group member descriptor (field name).
|
static java.lang.String |
FIELD_GROUP_MEMBER_EVENT
Group member event (field name).
|
static java.lang.String |
FIELD_GROUP_MEMBER_LIST
Group member list (field name).
|
static java.lang.String |
FIELD_GROUP_MEMBER_STATUS_LIST
Group member status list (field name).
|
static java.lang.String |
FIELD_GROUP_SERVER_AVAILABLE
Group member connection to group server (field name).
|
static java.lang.String |
PROPERTY_BOOLEAN_OBSERVER
Property name to monitor a group as an observer.
|
static java.lang.String |
PROPERTY_DOUBLE_ACTIVATION_INTERVAL
Property name for group activation interval.
|
static java.lang.String |
PROPERTY_LONG_MEMBER_WEIGHT
Property name to set the weight for a group member
|
static java.lang.String |
PROPERTY_MESSAGE_MEMBER_DESCRIPTOR
Property name for group member descriptor.
|
| Modifier and Type | Method and Description |
|---|---|
Message |
getMembers()
Returns the active members of group.
|
java.lang.String |
getName()
Return the group name.
|
long |
getOrdinal()
Returns the current ordinal of this member of group.
|
long |
getWeight()
Returns the weight for this member.
|
void |
leave()
Leave a group, and destroy the group object.
|
void |
setWeight(long weight)
Set the weight for this group member.
|
static final java.lang.String PROPERTY_DOUBLE_ACTIVATION_INTERVAL
Supply this (optional) property to
GroupFactory.join,
which derives heartbeat and timeout intervals from this property
value (in seconds). When absent, the default value is 5 seconds.
static final java.lang.String ADVISORY_MODULE_GROUP
This string value can appear in the module field.
Advisory.FIELD_MODULE,
Constant Field Valuesstatic final java.lang.String ADVISORY_NAME_ORDINAL_UPDATE
This string value can appear in the name field.
static final java.lang.String ADVISORY_FIELD_GROUP
The string value of the group name field is the name
of the group to which the advisory pertains.
static final java.lang.String ADVISORY_FIELD_ORDINAL
The positive long value of the ordinal field
represents the new ordinal of the group member.
The value -1 indicates that the group object is disconnected from the group server. The group object automatically attempts to reconnect, and continues until the program explicitly destroys it. Meanwhile, the group server could reassign the member's previous ordinal to another group member.
Zero is a reserved value.
static final java.lang.String PROPERTY_MESSAGE_MEMBER_DESCRIPTOR
To identify a group member to the other members,
supply this optional property to GroupFactory.join.
The application programmer determines the content of the descriptor message. In best practice, each group member process supplies a unique descriptor.
static final java.lang.String PROPERTY_BOOLEAN_OBSERVER
To monitor a group as an observer,
supply this optional property with value true
to GroupFactory.join.
An observer never receives an ordinal, and does not trigger group member events.
static final java.lang.String PROPERTY_LONG_MEMBER_WEIGHT
To set weight for a group member,
supply this optional property to GroupFactory.join.
Acceptable values are positive integers. When absent, the default value is 100. Zero is reserved value. FTL group service uses relative weight values to determine the ordinals of the group member; members with higher weight take precedence.
static final java.lang.String ADVISORY_NAME_GROUP_STATUS
This string value can appear in the name field.
static final java.lang.String FIELD_GROUP_MEMBER_STATUS_LIST
This field can appear in group status advisory messages. Its value is an array of member status submessages. Each submessage reports the status of one group member.
static final java.lang.String FIELD_GROUP_MEMBER_LIST
This field can appear in response message of 'getMembers' call.
Its a message array field where each element is a message containing following field at the most:
FIELD_GROUP_MEMBER_DESCRIPTOR
static final java.lang.String FIELD_GROUP_MEMBER_DESCRIPTOR
This field can can appear in a member status submessage. Its value is a group member descriptor, that is, a message that identifies a group member.
static final java.lang.String FIELD_GROUP_MEMBER_EVENT
This field can appear in a member status submessage.
Its value is a Group.GroupMemberEvent,
that is, a long value that indicates the group member's current state
or recent state change.
static final java.lang.String FIELD_GROUP_SERVER_AVAILABLE
This field can appear in a group status message.
Its value is a Group.GroupMemberServerConnection,
that is, a long value that indicates whether the application process
is connected to the group server.
void leave()
throws FTLException
This call informs the group server that the member is leaving the group. In response, the group server revises the ordinals of the remaining group members appropriately.
This call releases all resources held by the group object.
Before your program calls Realm.close, it must
first destroy all the group objects that it has created.
FTLExceptionlong getOrdinal()
throws FTLException
This call returns current ordinal of this member of the provided group.
FTLExceptionMessage getMembers() throws FTLException
This call returns all the members of group that are connected to group server.
FTLExceptionjava.lang.String getName()
This call returns the group name string that your program supplied
to GroupFactory.join.
long getWeight()
throws FTLException
FTLExceptionvoid setWeight(long weight)
throws FTLException
FTLException