01: // $Id: MembershipListener.java,v 1.7 2006/09/27 12:53:22 belaban Exp $
02:
03: package org.jgroups;
04:
05: /**
06: * Allows a listener to be notified when group membership changes.
07: * These callbacks are used in {@link org.jgroups.blocks.PullPushAdapter}.
08: * <p>
09: * The MembershipListener interface is similar to the {@link MessageListener}
10: * interface: every time a new view, a suspicion message, or a
11: * block event is received, the corresponding method of the class implementing
12: * MembershipListener will be called.
13: * Oftentimes the only method containing any functionality will be viewAccepted()
14: * which notifies the receiver that a new member has joined the group or that an
15: * existing member has left or crashed.
16: */
17: public interface MembershipListener {
18:
19: /**
20: * Called when a change in membership has occurred.
21: * <b>No long running actions should be done in this callback.</b>
22: * If some long running action needs to be performed, it should be done in a separate thread.
23: */
24: void viewAccepted(View new_view);
25:
26: /**
27: * Called whenever a member is suspected of having crashed,
28: * but has not yet been excluded.
29: */
30: void suspect(Address suspected_mbr);
31:
32: /**
33: * Called (usually by the FLUSH protocol), as an indication that the member should stop sending messages.
34: * Any messages sent after returning from this callback might get blocked by the FLUSH protocol. When the FLUSH
35: * protocol is done, and messages can be sent again, the FLUSH protocol will simply unblock all pending messages.
36: * If a callback for unblocking is desired, implement {@link org.jgroups.ExtendedMembershipListener#unblock()}.
37: * Note that block() is the equivalent of reception of a BlockEvent in the pull mode.
38: */
39: void block();
40:
41: }
|