|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgroup.relacs.gm.MembershipLayer
public final class MembershipLayer
The MembershipLayer class implements the group membership
service interface and provide membership events to listeners.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface jgroup.core.Layer |
|---|
Layer.FinalizeLayer |
| Field Summary |
|---|
| Fields inherited from interface jgroup.relacs.events.EventTags |
|---|
DAEMON_FAILURE_EVENT, DELIVERY_ACK, DELIVERY_EVENT, INSTALL_ACK, INSTALL_EVENT, JOIN_REQUEST, LEAVE_REQUEST, MEMBER_LEFT_EVENT, MULTICAST_REQUEST, PREPARE_ACK, PREPARE_EVENT |
| Method Summary | |
|---|---|
void |
addListener(java.lang.Object listener)
Add a listener object for this layer to provide upcalls to, in response to membership events. |
void |
complete(java.lang.Object server)
Post initialization of the MembershipLayer; invoked once
all group manager layers have been constructed. |
int[] |
eventTypes()
Returns the set of event types supported by this listener. |
int |
getGid()
Returns the group identifier. |
static MembershipLayer |
getLayer(DispatcherService dispatcher)
|
int |
getMemberIndex()
Position index of this member in the array containing the local members of the current view. |
MemberTable |
getMemberTable()
Returns a MemberTable helper object that will be
notified of changes in the membership. |
MemberId |
getMyIdentifier()
Returns the member identifier of the local member. |
int |
getViewIndex()
Position index of this member in the array containing the members of the current view. |
boolean |
isJoining()
Returns true if the GroupManager is in the process of
joining some group. |
boolean |
isLeader()
Returns true if the local member is the group leader. |
boolean |
isMember()
Returns true if the GroupManager is member of some
group. |
boolean |
isMemberOrJoining()
Returns true if the GroupManager is member of some group
or is in the process of joining some group. |
boolean |
isUnused()
|
void |
join()
Requests to join the default group associated with the Jgroup daemon. |
void |
join(int gid)
Requests to join a group identified by groupId. |
void |
leave()
Request to leave a group. |
int |
members()
Return the number of members of this group. |
void |
notifyEvent(Event event)
This method is invoked by a dispatcher to notify a listener about an event. |
java.lang.String |
toString()
Returns a string representation of this object; currently only the status and group identifier. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static MembershipLayer getLayer(DispatcherService dispatcher)
throws JgroupException
JgroupExceptionpublic void addListener(java.lang.Object listener)
addListener in interface Layerlistener - An Object representation of the listener interface.
This will typically be cast to the appropriate listener interface
type after checking the type with the instanceof operator.Layer.addListener(java.lang.Object)
public void complete(java.lang.Object server)
throws JgroupException
MembershipLayer; invoked once
all group manager layers have been constructed. This method is defined
in the FinalizeLayer inherited through the
MembershipSerivce.
This method is used to determine if the provided server should join the
group automatically, as soon as the group manager layer stack has been
completed. By default, automatic join is disabled. To enable auto join
you must configure it in the applications.xml file.
complete in interface Layer.FinalizeLayerserver - The server using a layer implementing the FinalizeLayer
interface.
JgroupException - Thrown if the layer could not be completed.
public void join()
throws JgroupException
MembershipServiceEach Jgroup daemon has a default group. If a Jgroup daemon does not need to be shared by multiple groups, the application servers may simply join the default group without having to specify group identifiers.
join in interface MembershipServiceJgroupException - Raised if the membership service receives a request to join a
group to which it is already a member.
public void join(int gid)
throws JgroupException
MembershipServicegroupId.
join in interface MembershipServicegid - Non-negative integer identifying the group.
JgroupException - Raised if the membership service receives a request to join a
group to which it is already a member.
public void leave()
throws JgroupException
MembershipServicehasLeft method is invoked. After this invocation,
the member will not receive any further event notification related
to the group.
leave in interface MembershipServiceJgroupException - Rasied if the server is not member of any group, or is already
leaving its current group.public boolean isMember()
MembershipServiceGroupManager is member of some
group. Otherwise, false is returned.
isMember in interface MembershipServicepublic boolean isJoining()
MembershipServiceGroupManager is in the process of
joining some group. Otherwise, false is returned.
isJoining in interface MembershipServicepublic boolean isMemberOrJoining()
MembershipServiceGroupManager is member of some group
or is in the process of joining some group. Otherwise, false is returned.
isMemberOrJoining in interface MembershipServicepublic boolean isUnused()
public boolean isLeader()
MembershipService
isLeader in interface MembershipServicepublic MemberId getMyIdentifier()
MembershipService
getMyIdentifier in interface MembershipServicepublic int getGid()
MembershipService
getGid in interface MembershipServicepublic MemberTable getMemberTable()
MembershipServiceMemberTable helper object that will be
notified of changes in the membership. This is used to provide
application developers with additional information about members
of their current view.
getMemberTable in interface MembershipServicepublic int members()
MembershipService
members in interface MembershipServicepublic int getViewIndex()
MembershipService
getViewIndex in interface MembershipServicepublic int getMemberIndex()
MembershipService
getMemberIndex in interface MembershipServicepublic int[] eventTypes()
DispatcherListenerEventTags interface.
eventTypes in interface DispatcherListenerpublic void notifyEvent(Event event)
DispatcherListener
notifyEvent in interface DispatcherListenerevent - The Event object to be processed.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||