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


##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java:
##########
@@ -2011,25 +2042,102 @@ else if (async)
                     ackC.apply(null);
             }
             else {
+                MessageMarshaller.marshal(ctx.messageFactory(), ioMsg, ctx, 
null);
+
+                sendMarshalled(node, ioMsg, ackC);
+            }
+        }
+    }
+
+    /**
+     * Wraps {@code msg} into a marshalled {@link GridIoMessage} without 
sending it. Message marshalling is not
+     * idempotent (see {@code MessageMarshalOnceTest}), so a caller that 
retries transmission must prepare the
+     * message once and re-send it via {@link #sendPrepared} on each attempt.
+     */
+    public GridIoMessage prepare(Object topic, Message msg, byte plc, boolean 
ordered, long timeout,

Review Comment:
   The split is deliberate: the retry loop lives in `GridCacheIoManager`, which 
owns the (cache-specific) send-retry policy — `GridIoManager` can't own it. 
`prepare` marshals once and returns the `GridIoMessage`; the caller then 
retries only `sendPrepared` on each attempt, which doesn't mutate the message. 
Folding them into one `GridIoManager` method would pull marshalling back inside 
the retry loop — exactly the non-idempotent re-marshal 
(`MessageMarshalOnceTest`) that this split fixes. Happy to reconsider the API 
shape if you have a specific encapsulation in mind that keeps marshalling 
outside the retry.



-- 
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