KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > util > Rsp


1 // $Id: Rsp.java,v 1.2 2005/01/20 02:04:13 ovidiuf Exp $
2

3 package org.jgroups.util;
4
5 import org.jgroups.Address;
6
7
8 /**
9  * class that represents a response from a communication
10  */

11 public class Rsp
12 {
13     /* flag that represents whether the response was received */
14     boolean received=false;
15     /* flag that represents whether the response was suspected */
16     boolean suspected=false;
17     /* The sender of this response */
18     Address sender=null;
19     /* the value from the response */
20     Object JavaDoc retval=null;
21
22
23     Rsp(Address sender)
24     {
25         this.sender=sender;
26     }
27
28     Rsp(Address sender, boolean suspected)
29     {
30         this.sender=sender;
31         this.suspected=suspected;
32     }
33
34     Rsp(Address sender, Object JavaDoc retval)
35     {
36         this.sender=sender;
37         this.retval=retval;
38         received=true;
39     }
40
41     public Object JavaDoc getValue()
42     {
43         return retval;
44     }
45
46     public Address getSender()
47     {
48         return sender;
49     }
50
51     public boolean wasReceived()
52     {
53         return received;
54     }
55
56     public boolean wasSuspected()
57     {
58         return suspected;
59     }
60
61     public String JavaDoc toString()
62     {
63         return "sender=" + sender + ", retval=" + retval + ", received=" +
64             received + ", suspected=" + suspected;
65     }
66 }
67
68
Popular Tags