|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroupmgmt.GroupDisseminator
The GroupDisseminator abstract class; Implementations of this class are responsible for coordinating group changes with members of the group, based on connection changes sent by the MemberDetector.
If the constructor is overridden it must call super().
changeGroup() must be implemented to respond to requests from the
MemberDetector.
start() and stop() must be implemented.
When the group is actually changed, the implementing class must call
fireGroupChangedEvent() to notify any listeners (ie the GroupManager)
of the actual change in the group.
Field Summary | |
private boolean |
active
Is this MemberDetector active (changing the group and notifying)? |
private java.util.Vector |
groupChangedListeners
A list of all GroupChangedListeners that are registered to receive GroupChangedEvents from this GroupDisseminator. |
Constructor Summary | |
GroupDisseminator()
Constructor. |
Method Summary | |
(package private) void |
activate()
The GroupManager calls this when we should activate the Disseminator. |
void |
addGroupChangedListener(GroupChangedListener listener)
Registers a GroupChangedListener to receive all GroupChangedEvents generated by this GroupDisseminator. |
(package private) boolean |
attemptChangeGroup(Member[] arriving,
Member[] departing)
Called by MemberDetector when it finds a change in connections. |
abstract void |
changeGroup(Member[] arriving,
Member[] departing)
Change the configuration of the current group. |
(package private) void |
deactivate()
The GroupManager calls this when we should deactivate the disseminator. |
protected void |
fireGroupChangedEvent(GroupChangedEvent event)
Sends a GroupChangedEvent to all registered listeners. |
boolean |
isActive()
Check if this GroupDisseminator is active. |
void |
removeGroupChangedListener(GroupChangedListener listener)
Unregisters a GroupChangedListener, stops sending GroupChangedEvents to the listener. |
protected abstract void |
start()
Start responding to changeGroup messages and fire GroupChangedEvents. |
protected abstract void |
stop()
Suspend all activity - stop firing GroupChangedEvents. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.Vector groupChangedListeners
private boolean active
Constructor Detail |
public GroupDisseminator()
Method Detail |
void activate()
void deactivate()
public boolean isActive()
protected abstract void start()
protected abstract void stop()
boolean attemptChangeGroup(Member[] arriving, Member[] departing)
arriving
- The Member(s) we are newly connected to.departing
- The Member(s) we are no longer connected to.
public abstract void changeGroup(Member[] arriving, Member[] departing)
arriving
- The Member(s) we are newly connected to.departing
- The Member(s) we are no longer connected to.public void addGroupChangedListener(GroupChangedListener listener)
listener
- The GroupChangedListener to receive events.public void removeGroupChangedListener(GroupChangedListener listener)
listener
- The GroupChangedListener to stop receiving events.protected void fireGroupChangedEvent(GroupChangedEvent event)
event
- The GroupChangedEvent to send.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |