1 /*
2 * Copyright (c) 1998-2002 The Jgroup Team.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 *
17 */
18
19 package jgroup.core;
20
21 import java.lang.annotation.Documented;
22 import java.lang.annotation.ElementType;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.lang.annotation.Target;
26
27 /**
28 * In order to be notified of membership events like view changes, an
29 * object must implement this interface.
30 *
31 * @author Alberto Montresor
32 * @since Jgroup 0.1
33 */
34 public interface MembershipListener
35 {
36
37 /**
38 * Annotation marker used to indicate that the <code>viewChange()</code>
39 * method should allow invocations in which the two consecutive views have the
40 * same set of members. <i>The default is to suppress duplicate views.</i>
41 *
42 * @author Hein Meling
43 * @since Jgroup 3.0
44 */
45 @Documented
46 @Retention(RetentionPolicy.RUNTIME)
47 @Target(ElementType.METHOD)
48 public @interface AllowDuplicateViews { }
49
50 /**
51 * Upcall invoked on members implementing the <code>MembershipListener</code>
52 * interface, when a view change occurs.
53 *
54 * @param view
55 * The new view that has been installed.
56 * @see jgroup.core.MembershipService
57 */
58 public void viewChange(View view);
59
60
61 /**
62 * Upcall that is invoked by the group membership service to notify
63 * that the current view is not valid any more, and the group
64 * membership service is trying to reach an agreement on a new view.
65 *
66 * @see jgroup.core.MembershipService
67 */
68 public void prepareChange();
69
70
71 /**
72 * Upcall that is invoked by Jgroup to acknowledge the fact that this
73 * object has left the group. This method is only invoked after the
74 * <code>leave</code> method has been invoked on the group membership
75 * service.
76 *
77 * @see jgroup.core.MembershipService
78 */
79 public void hasLeft();
80
81 } // END MembershipListener