View Javadoc

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.multicast;
20  
21  import java.rmi.Remote;
22  import java.rmi.RemoteException;
23  
24  import jgroup.core.MemberId;
25  import jgroup.core.View;
26  
27  /**
28   * This interface enables members to receive ack messages in response
29   * to multicasts. When a message is delivered, upcall methods
30   * <t>deliverStream</t> and <t>deliverObject</t> of interface
31   * <t>MulticastListener</t> are invoked. <t>MulticastListener</t>
32   * objects may respond to these invocations by returning an
33   * object, that will be delivered to the multicast sender
34   * through the <t>AckListener</t> interface.
35   *
36   * @author  Alberto Montresor
37   * @since   Jgroup 0.8
38   */
39  public interface AckListener
40    extends Remote
41  {
42  
43    /**
44     * Upcalls invoked by Jgroup to notify the ack listener
45     * about the view in which the multicast message is
46     * delivered. Note that following the Jgroup specification,
47     * a message may be delivered in a view different from the
48     * one in which the message has been multicast; this is
49     * motivated by the fact that during agreement protocols,
50     * no new messages can be delivered; in fact, cascading
51     * sequences of delivered messages could prevent the
52     * completion of agreement protocols.<p>
53     *
54     * This property corresponds to the <i>Same View Delivery</i>
55     * property of the GCS-Survery paper of Chockler et al, which
56     * states that all those who deliver a message must do so in
57     * the same view, however without requiring that this occur in
58     * the same view as it was sent.
59     *
60     * @param view the view in which the multicast message is
61     *   delivered
62     */
63    public void notifyView(View view)
64      throws RemoteException;
65  
66  
67    /**
68     * Upcalls invoked by Jgroup to notify the ack listener
69     * that the member identified by <tt>id</tt> has responded
70     * with <tt>obj</tt> to the multicast message associated with
71     * this ack listener. <p>
72     *
73     * Member <tt>id</tt> is contained in the view notified by
74     * <tt>notifyView</tt>.
75     *
76     * @param id the identifier of the member responding to the
77     *   multicast message
78     * @param pos position of the member in the last installed view
79     * @param obj the response message
80     */
81    public void ack(MemberId id, int pos, Object obj)
82      throws RemoteException;
83  
84  
85    /**
86     * Upcalls invoked by Jgroup to notify the ack listener
87     * that a new view has been installed after the view
88     * in which the message has been delivered. After this
89     * event, no missing response messages for the multicast
90     * message associated with this ack listener will ever
91     * be accepted.
92     */
93    public void viewChange()
94      throws RemoteException;
95  
96  } // END AckListener