1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package jgroup.relacs.events;
20
21 import java.io.IOException;
22 import java.io.ObjectInput;
23 import java.io.ObjectOutput;
24
25 import jgroup.core.MemberId;
26 import jgroup.core.multicast.AckListener;
27 import jgroup.core.multicast.ChainIdentifier;
28 import jgroup.relacs.types.Flag;
29 import jgroup.relacs.types.MemberIdImpl;
30 import jgroup.util.OutMessage;
31
32
33
34
35
36
37
38
39 public final class MulticastRequest
40 extends Event
41 {
42
43
44
45
46
47 private static final long serialVersionUID = 6936202150321190893L;
48
49
50 private OutMessage payload;
51
52
53 private boolean isObject;
54
55
56 private MemberId sender;
57
58
59 private AckListener ackListener;
60
61
62 private ChainIdentifier chainId;
63
64
65
66
67
68
69
70
71
72 public MulticastRequest() { }
73
74
75
76
77
78
79
80
81
82
83
84
85 public MulticastRequest(int gid, boolean isObject, OutMessage payload,
86 MemberId sender, AckListener ackListener, ChainIdentifier chId)
87 {
88 super(MULTICAST_REQUEST, gid);
89 this.payload = payload;
90 this.isObject = isObject;
91 this.sender = sender;
92 this.ackListener = ackListener;
93 this.chainId = chId;
94 }
95
96
97
98
99
100
101
102
103
104 public OutMessage getPayload()
105 {
106 return payload;
107 }
108
109
110
111
112 public boolean isObject()
113 {
114 return isObject;
115 }
116
117
118
119
120 public MemberId getSender()
121 {
122 return sender;
123 }
124
125
126
127
128 public AckListener getAckListener()
129 {
130 return ackListener;
131 }
132
133
134
135
136 public ChainIdentifier getChainId()
137 {
138 return chainId;
139 }
140
141
142
143
144
145
146 public String toString()
147 {
148 StringBuilder buf = new StringBuilder();
149 buf.append("[");
150 buf.append(super.toString());
151 buf.append(", sender=");
152 buf.append(sender);
153 buf.append(", isObj=");
154 buf.append(isObject);
155 buf.append(", ackListener=");
156 buf.append(ackListener);
157 buf.append(", payload=");
158 buf.append(payload);
159 if (chainId != null) {
160 buf.append(", chainId=");
161 buf.append(chainId);
162 }
163 return buf.toString();
164 }
165
166
167
168
169
170
171
172
173
174
175
176
177 public void readExternal(ObjectInput in)
178 throws IOException, ClassNotFoundException
179 {
180 super.readExternal(in);
181 sender = new MemberIdImpl();
182 sender.readExternal(in);
183 isObject = Flag.unmarshal(in);
184 ackListener = (AckListener) in.readObject();
185 payload = (OutMessage) in.readObject();
186 chainId = (ChainIdentifier) in.readObject();
187 }
188
189
190
191
192
193
194 public void writeExternal(ObjectOutput out)
195 throws IOException
196 {
197 super.writeExternal(out);
198 sender.writeExternal(out);
199 Flag.marshal(out, isObject);
200 out.writeObject(ackListener);
201 out.writeObject(payload);
202 out.writeObject(chainId);
203 }
204
205 }
206