sergey-chugunov-1985 commented on code in PR #12110:
URL: https://github.com/apache/ignite/pull/12110#discussion_r2121364410


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java:
##########
@@ -308,17 +305,11 @@ public void prepareDirectMarshal(CacheObjectContext ctx) 
throws IgniteCheckedExc
 
         }
 
-        assert key != null;

Review Comment:
   Do I undestand correctly that we want to make outside code responsible for 
this sort of checks? From codegeneration standpoint of view this code doesn't 
make sense, but we may want to make this information explicit - in javadoc of 
Message interface or somewhere else.



##########
modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java:
##########
@@ -39,246 +39,198 @@ public interface MessageReader {
      */
     public void setBuffer(ByteBuffer buf);
 
-    /**
-     * Sets type of message currently read.
-     *
-     * @param msgCls Message type.
-     */
-    public void setCurrentReadClass(Class<? extends Message> msgCls);
-
-    /**
-     * Callback that must be invoked by a message implementation before 
message body started decoding.
-     *
-     * @return {@code True} if reading can proceed, {@code false} otherwise.
-     */
-    public boolean beforeMessageRead();
-
-    /**
-     * Callback that must be invoked by a message implementation after message 
body finished decoding.
-     *
-     * @param msgCls Message class finishing read stage.
-     * @return {@code True} if reading can proceed, {@code false} otherwise.
-     */
-    public boolean afterMessageRead(Class<? extends Message> msgCls);
-
     /**
      * Reads {@code byte} value.
      *
-     * @param name Field name.
      * @return {@code byte} value.
      */
-    public byte readByte(String name);
+    public byte readByte();
 
     /**
      * Reads {@code short} value.
      *
-     * @param name Field name.
      * @return {@code short} value.
      */
-    public short readShort(String name);
+    public short readShort();
 
     /**
      * Reads {@code int} value.
      *
-     * @param name Field name.
      * @return {@code int} value.
      */
-    public int readInt(String name);
+    public int readInt();
 
     /**
      * Reads {@code int} value.
      *
-     * @param name Field name.
      * @param dflt Default value if field not found.
      * @return {@code int} value.
      */
-    public int readInt(String name, int dflt);
+    public int readInt(int dflt);

Review Comment:
   I wonder if we can get rid of this method too as its implementation simply 
delegates to `readInt` w/o parameters, effectively ignoring any value passed 
into as `dflt`.



##########
modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteIoCommunicationMessageSerializationTest.java:
##########
@@ -59,33 +53,23 @@ private static class TestIoMessageReader extends 
AbstractTestMessageReader {
         /** */
         private static final byte[] BYTE_ARR = toBytes(null);
 
-        /** */
-        protected Class<? extends Message> msgCls;
-
         /** */
         public TestIoMessageReader(int capacity) {
             super(capacity);
         }
 
         /** {@inheritDoc} */
-        @Override public void setCurrentReadClass(Class<? extends Message> 
msgCls) {
-            this.msgCls = msgCls;
-        }
-
-        /** {@inheritDoc} */
-        @Override public byte[] readByteArray(String name) {
-            super.readByteArray(name);
+        @Override public byte[] readByteArray() {
+            super.readByteArray();
 
             return BYTE_ARR;
         }
 
-        /** {@inheritDoc} */
-        @Override public <T extends Message> T readMessage(String name) {
-            super.readMessage(name);
-
-            return msgCls.equals(GridCacheRawVersionedEntry.class) && 
"key".equals(name)
-                ? (T)new KeyCacheObjectImpl()
-                : null;
-        }
+//        /** {@inheritDoc} */

Review Comment:
   Could you please leave a comment here clarifying why this peice of code is 
commented out and when it can be uncommented?



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to