|
17 | 17 |
|
18 | 18 | package org.apache.ignite.internal.processors.continuous; |
19 | 19 |
|
20 | | -import java.nio.ByteBuffer; |
21 | 20 | import java.util.Collection; |
22 | 21 | import java.util.UUID; |
23 | | -import org.apache.ignite.internal.GridDirectCollection; |
24 | | -import org.apache.ignite.internal.GridDirectTransient; |
| 22 | +import org.apache.ignite.internal.Order; |
25 | 23 | import org.apache.ignite.internal.util.tostring.GridToStringInclude; |
26 | 24 | import org.apache.ignite.internal.util.typedef.internal.S; |
27 | 25 | import org.apache.ignite.lang.IgniteUuid; |
28 | 26 | import org.apache.ignite.plugin.extensions.communication.Message; |
29 | | -import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType; |
30 | | -import org.apache.ignite.plugin.extensions.communication.MessageReader; |
31 | | -import org.apache.ignite.plugin.extensions.communication.MessageWriter; |
32 | 27 | import org.jetbrains.annotations.Nullable; |
33 | 28 |
|
34 | 29 | import static org.apache.ignite.internal.processors.continuous.GridContinuousMessageType.MSG_EVT_ACK; |
|
38 | 33 | */ |
39 | 34 | public class GridContinuousMessage implements Message { |
40 | 35 | /** Message type. */ |
41 | | - private GridContinuousMessageType type; |
| 36 | + @Order(0) |
| 37 | + GridContinuousMessageType type; |
42 | 38 |
|
43 | 39 | /** Routine ID. */ |
44 | | - private UUID routineId; |
| 40 | + @Order(1) |
| 41 | + UUID routineId; |
45 | 42 |
|
46 | 43 | /** Optional message data. */ |
47 | 44 | @GridToStringInclude(sensitive = true) |
48 | | - @GridDirectTransient |
49 | 45 | private Object data; |
50 | 46 |
|
51 | 47 | /** */ |
52 | | - @GridDirectCollection(Message.class) |
53 | | - private Collection<Message> msgs; |
| 48 | + @Order(2) |
| 49 | + Collection<Message> msgs; |
54 | 50 |
|
55 | 51 | /** Serialized message data. */ |
56 | | - private byte[] dataBytes; |
| 52 | + @Order(3) |
| 53 | + byte[] dataBytes; |
57 | 54 |
|
58 | 55 | /** Future ID for synchronous event notifications. */ |
59 | | - private IgniteUuid futId; |
| 56 | + @Order(4) |
| 57 | + IgniteUuid futId; |
60 | 58 |
|
61 | 59 | /** |
62 | 60 | * Empty constructor. |
@@ -146,107 +144,6 @@ public void dataBytes(byte[] dataBytes) { |
146 | 144 | return futId; |
147 | 145 | } |
148 | 146 |
|
149 | | - /** {@inheritDoc} */ |
150 | | - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { |
151 | | - writer.setBuffer(buf); |
152 | | - |
153 | | - if (!writer.isHeaderWritten()) { |
154 | | - if (!writer.writeHeader(directType())) |
155 | | - return false; |
156 | | - |
157 | | - writer.onHeaderWritten(); |
158 | | - } |
159 | | - |
160 | | - switch (writer.state()) { |
161 | | - case 0: |
162 | | - if (!writer.writeByteArray(dataBytes)) |
163 | | - return false; |
164 | | - |
165 | | - writer.incrementState(); |
166 | | - |
167 | | - case 1: |
168 | | - if (!writer.writeIgniteUuid(futId)) |
169 | | - return false; |
170 | | - |
171 | | - writer.incrementState(); |
172 | | - |
173 | | - case 2: |
174 | | - if (!writer.writeCollection(msgs, MessageCollectionItemType.MSG)) |
175 | | - return false; |
176 | | - |
177 | | - writer.incrementState(); |
178 | | - |
179 | | - case 3: |
180 | | - if (!writer.writeUuid(routineId)) |
181 | | - return false; |
182 | | - |
183 | | - writer.incrementState(); |
184 | | - |
185 | | - case 4: |
186 | | - if (!writer.writeByte(type != null ? (byte)type.ordinal() : -1)) |
187 | | - return false; |
188 | | - |
189 | | - writer.incrementState(); |
190 | | - |
191 | | - } |
192 | | - |
193 | | - return true; |
194 | | - } |
195 | | - |
196 | | - /** {@inheritDoc} */ |
197 | | - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { |
198 | | - reader.setBuffer(buf); |
199 | | - |
200 | | - switch (reader.state()) { |
201 | | - case 0: |
202 | | - dataBytes = reader.readByteArray(); |
203 | | - |
204 | | - if (!reader.isLastRead()) |
205 | | - return false; |
206 | | - |
207 | | - reader.incrementState(); |
208 | | - |
209 | | - case 1: |
210 | | - futId = reader.readIgniteUuid(); |
211 | | - |
212 | | - if (!reader.isLastRead()) |
213 | | - return false; |
214 | | - |
215 | | - reader.incrementState(); |
216 | | - |
217 | | - case 2: |
218 | | - msgs = reader.readCollection(MessageCollectionItemType.MSG); |
219 | | - |
220 | | - if (!reader.isLastRead()) |
221 | | - return false; |
222 | | - |
223 | | - reader.incrementState(); |
224 | | - |
225 | | - case 3: |
226 | | - routineId = reader.readUuid(); |
227 | | - |
228 | | - if (!reader.isLastRead()) |
229 | | - return false; |
230 | | - |
231 | | - reader.incrementState(); |
232 | | - |
233 | | - case 4: |
234 | | - byte typeOrd; |
235 | | - |
236 | | - typeOrd = reader.readByte(); |
237 | | - |
238 | | - if (!reader.isLastRead()) |
239 | | - return false; |
240 | | - |
241 | | - type = GridContinuousMessageType.fromOrdinal(typeOrd); |
242 | | - |
243 | | - reader.incrementState(); |
244 | | - |
245 | | - } |
246 | | - |
247 | | - return true; |
248 | | - } |
249 | | - |
250 | 147 | /** {@inheritDoc} */ |
251 | 148 | @Override public short directType() { |
252 | 149 | return 61; |
|
0 commit comments