anton-vinogradov commented on code in PR #13095:
URL: https://github.com/apache/ignite/pull/13095#discussion_r3589162959


##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryIoSession.java:
##########
@@ -196,6 +196,8 @@ <T> T readMessage() throws IgniteCheckedException, 
IOException {
             }
             while (!finished);
 
+            MessageMarshaller.unmarshal(spi.messageFactory(), msg, 
((IgniteEx)spi.ignite()).context());

Review Comment:
   They're two distinct stages by design, and this `readMessage` already 
encapsulates both. `MessageSerializer.readFrom` runs in the streaming loop 
above, decoding the `@Order` wire fields as bytes arrive — it's context-free 
(serializers live in the `nio` module and never touch the kernal context). 
`MessageMarshalling.unmarshal` then runs exactly once, after the full message 
is read, to finish the custom `@Marshalled` payloads (byte-blobs → objects, 
cache-object resolution) using the kernal context. They can't be folded 
together: `readFrom` may be called many times per message (partial reads), 
while `unmarshal` must run once; and pushing marshalling into the serializer 
would force it to carry the kernal context, breaking the module boundary. This 
mirrors the communication receive path (`GridDirectParser` decodes via the 
serializer, then `GridIoManager`/`GridCacheIoManager` unmarshal) — discovery 
follows the same two-stage contract rather than any ad-hoc IO logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to