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


##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteMessageFactoryImpl.java:
##########
@@ -20,16 +20,19 @@
 import java.lang.reflect.Array;
 import java.util.function.Supplier;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.DeployableMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheMessageDeployer;
+import org.apache.ignite.plugin.extensions.communication.MarshallableMessage;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
+import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
 import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Message factory implementation which is responsible for instantiation of 
all communication messages.

Review Comment:
   Fixed — "…all messages sent between nodes, both over the communication SPI 
and via discovery", matching the `Message` javadoc.



##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteMessageFactoryImpl.java:
##########
@@ -42,6 +45,13 @@ public class IgniteMessageFactoryImpl implements 
MessageFactory {
     /** Message serializers. */
     private final MessageSerializer[] msgSerializers = 
(MessageSerializer[])Array.newInstance(MessageSerializer.class, ARR_SIZE);
 
+    /** Message marshallers (null entry = no marshaller registered for that 
type). */
+    private final MessageMarshaller[] msgMarshallers = 
(MessageMarshaller[])Array.newInstance(MessageMarshaller.class, ARR_SIZE);
+
+    /** Message deployers (null entry = no deployer registered for that type). 
*/
+    private final GridCacheMessageDeployer[] msgDeployers =
+        
(GridCacheMessageDeployer[])Array.newInstance(GridCacheMessageDeployer.class, 
ARR_SIZE);
+
     /** Initialized flag. If {@code true} then new message type couldn't be 
registered. */
     private boolean initialized;

Review Comment:
   Done.



##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteMessageFactory.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.managers.communication;
+
+import java.util.function.Supplier;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.GridCacheMessageDeployer;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageFactory;
+import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
+import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Internal extension of {@link MessageFactory} that also registers and 
resolves the marshal and deployment
+ * companions of a message. Kept out of the public factory interface: 
marshallers and deployers are bound to
+ * kernal and cache internals ({@code GridKernalContext}, {@code 
GridCacheSharedContext}) the public SPI module
+ * must not depend on.
+ *
+ * @see MessageMarshaller
+ * @see GridCacheMessageDeployer
+ */
+public interface IgniteMessageFactory extends MessageFactory {
+    /** {@inheritDoc} */
+    @Override default void register(short directType, Supplier<Message> 
supplier, MessageSerializer serializer)
+        throws IgniteException {
+        register(directType, supplier, serializer, null, null);
+    }
+
+    /**
+     * Register message factory with given direct type, serializer, and 
marshaller. All messages must be registered
+     * during construction of class which implements this interface.

Review Comment:
   Fixed everywhere in both files (plus the constructor javadoc typos).



##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteMessageFactory.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.managers.communication;
+
+import java.util.function.Supplier;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.GridCacheMessageDeployer;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageFactory;
+import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
+import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Internal extension of {@link MessageFactory} that also registers and 
resolves the marshal and deployment
+ * companions of a message. Kept out of the public factory interface: 
marshallers and deployers are bound to
+ * kernal and cache internals ({@code GridKernalContext}, {@code 
GridCacheSharedContext}) the public SPI module
+ * must not depend on.
+ *
+ * @see MessageMarshaller
+ * @see GridCacheMessageDeployer
+ */
+public interface IgniteMessageFactory extends MessageFactory {
+    /** {@inheritDoc} */
+    @Override default void register(short directType, Supplier<Message> 
supplier, MessageSerializer serializer)
+        throws IgniteException {
+        register(directType, supplier, serializer, null, null);
+    }
+
+    /**
+     * Register message factory with given direct type, serializer, and 
marshaller. All messages must be registered
+     * during construction of class which implements this interface.
+     *
+     * @param directType Direct type.

Review Comment:
   Reworded everywhere: the tautological "Direct type." became "Direct type 
(`Message#directType()`) to register the message under" — the name itself stays 
`directType`, see the sibling thread.



##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteMessageFactoryImpl.java:
##########
@@ -69,15 +79,38 @@ public IgniteMessageFactoryImpl(MessageFactoryProvider[] 
factories) {
         initialized = true;
     }
 
-    /** {@inheritDoc} */
-    @Override public void register(short directType, Supplier<Message> 
supplier, MessageSerializer serializer) throws IgniteException {
+    /**
+     * Registers a message type with a serializer, an optional marshaller, and 
an optional deployer.

Review Comment:
   Fixed — "Registers a message with…"; the `@param supplier` also became 
"Message supplier".



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