Vladsz83 commented on code in PR #13454: URL: https://github.com/apache/ignite/pull/13454#discussion_r3751835601
########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java: ########## @@ -0,0 +1,70 @@ +/* + * 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.processors.datastreamer; + +import org.apache.ignite.internal.Marshalled; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.UseBinaryMarshaller; +import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.stream.StreamReceiver; +import org.jetbrains.annotations.Nullable; + +/** DataStreamer cache receiver/updater message. */ +@UseBinaryMarshaller +public class DataStreamerReceiverMessage implements Message { + /** Custom cache receiver/updater; {@code null} when {@link #builtIn} is effective. */ + @Nullable + @Marshalled("rcvrBytes") + StreamReceiver<?, ?> rcvr; Review Comment: `@Nullable StreamReceiver<?, ?> rcvr;` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java: ########## @@ -0,0 +1,70 @@ +/* + * 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.processors.datastreamer; + +import org.apache.ignite.internal.Marshalled; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.UseBinaryMarshaller; +import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.stream.StreamReceiver; +import org.jetbrains.annotations.Nullable; + +/** DataStreamer cache receiver/updater message. */ +@UseBinaryMarshaller +public class DataStreamerReceiverMessage implements Message { + /** Custom cache receiver/updater; {@code null} when {@link #builtIn} is effective. */ + @Nullable + @Marshalled("rcvrBytes") + StreamReceiver<?, ?> rcvr; + + /** Serialized {@link #rcvr}. */ + @Order(0) + volatile byte[] rcvrBytes; Review Comment: `@Nullable byte[] rcvrBytes` ? ########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java: ########## @@ -235,9 +230,11 @@ private void processRequest(final UUID nodeId, final DataStreamerRequest req) { StreamReceiver<?, ?> updater; try { - updater = U.unmarshal(marsh, req.updaterBytes(), U.resolveClassLoader(clsLdr, ctx.config())); + MessageMarshalling.unmarshal(req, ctx, null, U.resolveClassLoader(clsLdr, ctx.config())); + + updater = req.updater(); - if (updater != null) + if (req.hasCustomUpdater()) Review Comment: Ignite style is `hasCustomUpdater()` -> `customUpdater()` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java: ########## @@ -0,0 +1,70 @@ +/* + * 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.processors.datastreamer; + +import org.apache.ignite.internal.Marshalled; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.UseBinaryMarshaller; +import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.stream.StreamReceiver; +import org.jetbrains.annotations.Nullable; + +/** DataStreamer cache receiver/updater message. */ +@UseBinaryMarshaller +public class DataStreamerReceiverMessage implements Message { + /** Custom cache receiver/updater; {@code null} when {@link #builtIn} is effective. */ + @Nullable + @Marshalled("rcvrBytes") + StreamReceiver<?, ?> rcvr; + + /** Serialized {@link #rcvr}. */ + @Order(0) + volatile byte[] rcvrBytes; + + /** A built-in updater every node has; {@code null} when {@link #rcvr} is effective. */ + @Nullable + @Order(1) + DataStreamerBuiltInUpdater builtIn; + + /** Empty constructor for serialization purposes. */ + public DataStreamerReceiverMessage() { + // No-op. + } + + /** @param rcvr Custom receiver. */ + DataStreamerReceiverMessage(StreamReceiver<?, ?> rcvr) { + assert DataStreamerBuiltInUpdater.of(rcvr) == null : "A built-in updater travels by name: " + rcvr; + + this.rcvr = rcvr; + } + + /** @param builtIn A built-in updater every node has, named rather than carried. */ + DataStreamerReceiverMessage(DataStreamerBuiltInUpdater builtIn) { + this.builtIn = builtIn; + } + + /** @return {@code True} if this is a custom receiver, {@code false} if a built-in one. */ + boolean custom() { + return builtIn == null; + } + + /** @return Receiver: the custom one carried here, or the built-in one this message names. */ Review Comment: Same. Let's make it equal. Built-in/custom ########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java: ########## @@ -0,0 +1,70 @@ +/* + * 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.processors.datastreamer; + +import org.apache.ignite.internal.Marshalled; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.UseBinaryMarshaller; +import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.stream.StreamReceiver; +import org.jetbrains.annotations.Nullable; + +/** DataStreamer cache receiver/updater message. */ +@UseBinaryMarshaller +public class DataStreamerReceiverMessage implements Message { + /** Custom cache receiver/updater; {@code null} when {@link #builtIn} is effective. */ + @Nullable + @Marshalled("rcvrBytes") + StreamReceiver<?, ?> rcvr; + + /** Serialized {@link #rcvr}. */ + @Order(0) + volatile byte[] rcvrBytes; + + /** A built-in updater every node has; {@code null} when {@link #rcvr} is effective. */ + @Nullable + @Order(1) + DataStreamerBuiltInUpdater builtIn; + + /** Empty constructor for serialization purposes. */ + public DataStreamerReceiverMessage() { + // No-op. + } + + /** @param rcvr Custom receiver. */ + DataStreamerReceiverMessage(StreamReceiver<?, ?> rcvr) { + assert DataStreamerBuiltInUpdater.of(rcvr) == null : "A built-in updater travels by name: " + rcvr; + + this.rcvr = rcvr; + } + + /** @param builtIn A built-in updater every node has, named rather than carried. */ Review Comment: `named rather than carried`. Same. Let's make it equal. `Built-in/custom` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java: ########## @@ -0,0 +1,70 @@ +/* + * 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.processors.datastreamer; + +import org.apache.ignite.internal.Marshalled; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.UseBinaryMarshaller; +import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.stream.StreamReceiver; +import org.jetbrains.annotations.Nullable; + +/** DataStreamer cache receiver/updater message. */ +@UseBinaryMarshaller +public class DataStreamerReceiverMessage implements Message { + /** Custom cache receiver/updater; {@code null} when {@link #builtIn} is effective. */ + @Nullable + @Marshalled("rcvrBytes") + StreamReceiver<?, ?> rcvr; + + /** Serialized {@link #rcvr}. */ + @Order(0) + volatile byte[] rcvrBytes; + + /** A built-in updater every node has; {@code null} when {@link #rcvr} is effective. */ + @Nullable + @Order(1) + DataStreamerBuiltInUpdater builtIn; Review Comment: `@Nullable DataStreamerBuiltInUpdater builtIn;` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java: ########## @@ -240,7 +235,10 @@ private void processRequest(final UUID nodeId, final DataStreamerRequest req) { StreamReceiver<?, ?> updater; try { - updater = U.unmarshal(marsh, req.updaterBytes(), U.resolveClassLoader(clsLdr, ctx.config())); + // Read here, not on the inbound pass: the deployment class loader is known only at this point. + MessageMarshalling.unmarshal(req, ctx, null, U.resolveClassLoader(clsLdr, ctx.config())); Review Comment: @anton-vinogradov pls resolve this comment -- 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]
