From 7ca597b96998c7dd4363e9e811b9bff23d273e51 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Wed, 11 Mar 2026 17:43:32 +0300 Subject: [PATCH 01/12] WIP --- .../query/calcite/message/MessageType.java | 5 +- .../internal/MessageSerializerGenerator.java | 40 +++++++++ .../managers/communication/ErrorMessage.java | 84 ++++--------------- .../managers/communication/GridIoManager.java | 2 +- .../communication/GridIoMessageFactory.java | 21 ++++- .../discovery/DiscoveryMessageFactory.java | 4 +- .../communication/MarshallableMessage.java | 5 +- .../TcpDiscoveryClientReconnectMessage.java | 25 +----- .../TcpDiscoveryJoinRequestMessage.java | 25 +----- .../TcpDiscoveryNodeAddFinishedMessage.java | 25 +----- .../direct/DirectMarshallingMessagesTest.java | 4 +- .../communication/CompressedMessageTest.java | 3 +- .../communication/ErrorMessageSelfTest.java | 22 +++-- ...CommunicationMessageSerializationTest.java | 4 +- ...acheContinuousQueryImmutableEntryTest.java | 4 +- .../GridAbstractCommunicationSelfTest.java | 3 +- ...unicationSpiConcurrentConnectSelfTest.java | 4 +- ...GridTcpCommunicationSpiConfigSelfTest.java | 3 +- ...CommunicationSpiMultithreadedSelfTest.java | 3 +- ...cpCommunicationSpiRecoveryAckSelfTest.java | 4 +- ...idTcpCommunicationSpiRecoverySelfTest.java | 4 +- ...mmunicationRecoveryAckClosureSelfTest.java | 4 +- .../testframework/GridSpiTestContext.java | 4 +- ...hallableMessageMarshallableSerializer.java | 18 +++- 24 files changed, 157 insertions(+), 163 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java index 44438a8d4892b..75aeb4bb5297c 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java @@ -24,8 +24,11 @@ import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentDescriptionSerializer; import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentMapping; import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentMappingSerializer; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.MessageSerializer; +import static org.apache.ignite.marshaller.Marshallers.jdk; + /** * */ @@ -37,7 +40,7 @@ public enum MessageType { QUERY_START_RESPONSE(301, QueryStartResponse::new, new QueryStartResponseSerializer()), /** */ - QUERY_ERROR_MESSAGE(302, CalciteErrorMessage::new, new CalciteErrorMessageSerializer()), + QUERY_ERROR_MESSAGE(302, CalciteErrorMessage::new, new CalciteErrorMessageMarshallableSerializer(jdk(), U.gridClassLoader())), /** */ QUERY_BATCH_MESSAGE(303, QueryBatchMessage::new, new QueryBatchMessageSerializer()), diff --git a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java index 8acc83f01c099..8cb762250d4e7 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java @@ -280,9 +280,29 @@ private void start(Collection code, boolean write) { returnFalseIfWriteFailed(code, "writer.writeHeader", "directType()"); if (write && marshallableMessage()) { + imports.add("org.apache.ignite.IgniteCheckedException"); + imports.add("org.apache.ignite.IgniteException"); + code.add(EMPTY); + code.add(identedLine("try {")); + + indent++; + code.add(identedLine("msg.prepareMarshal(marshaller);")); + + indent--; + + code.add(identedLine("}")); + code.add(identedLine("catch (IgniteCheckedException e) {")); + + indent++; + + code.add(identedLine("throw new IgniteException(\"Failed to marshal object\", e);")); + + indent--; + + code.add(identedLine("}")); } code.add(EMPTY); @@ -949,8 +969,28 @@ private void finish(List code, boolean read, boolean marshallable) { code.add(EMPTY); if (read && marshallable) { + imports.add("org.apache.ignite.IgniteCheckedException"); + imports.add("org.apache.ignite.IgniteException"); + + code.add(identedLine("try {")); + + indent++; + code.add(identedLine("msg.finishUnmarshal(marshaller, clsLdr);")); + indent--; + + code.add(identedLine("}")); + code.add(identedLine("catch (IgniteCheckedException e) {")); + + indent++; + + code.add(identedLine("throw new IgniteException(\"Failed to unmarshal object\", e);")); + + indent--; + + code.add(identedLine("}")); + code.add(EMPTY); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java index 34146c63d11d4..917136ba2df5b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java @@ -17,41 +17,26 @@ package org.apache.ignite.internal.managers.communication; -import java.io.Serializable; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.MessageProcessor; import org.apache.ignite.internal.Order; import org.apache.ignite.internal.util.tostring.GridToStringExclude; -import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.marshaller.jdk.JdkMarshaller; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; +import org.apache.ignite.marshaller.Marshaller; +import org.apache.ignite.plugin.extensions.communication.MarshallableMessage; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.marshaller.Marshallers.jdk; - /** * Message used to transfer {@link Throwable} objects. - *

Because raw serialization of throwables is prohibited, you should use this message when it is necessary - * to transfer some error as part of some message. See {@link MessageProcessor} for details. - *

Currently, under the hood marshalling and unmarshalling is performed by {@link JdkMarshaller}. - *

If the message serialization fails, wraps this error with own one. */ @SuppressWarnings({"NullableProblems", "unused"}) -// TODO Remove Serializable once https://issues.apache.org/jira/browse/IGNITE-27627 is completed. -public class ErrorMessage implements Message, Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Serialization and deserealization call holder. */ - @Order(value = 0, method = "errorBytes") +public class ErrorMessage implements MarshallableMessage { + /** Error bytes. */ + @Order(0) @GridToStringExclude @Nullable public byte[] errBytes; - /** Original error. It is transient and necessary only to avoid duplicated serialization and deserializtion. */ + /** Error. */ private @Nullable Throwable err; /** @@ -62,61 +47,20 @@ public ErrorMessage() { } /** - * @param err Original error. Will be lazily serialized. + * @param err Original error. */ public ErrorMessage(@Nullable Throwable err) { this.err = err; } - /** - * Provides serialized bytes of the error. Should be called only once. - * - * @return Serialized error. - * @see MessageWriter - */ - public @Nullable byte[] errorBytes() { - if (err == null) - return null; - - try { - return U.marshal(jdk(), err); - } - catch (IgniteCheckedException e0) { - IgniteCheckedException wrappedErr = new IgniteCheckedException(err.getMessage()); - - wrappedErr.setStackTrace(err.getStackTrace()); - wrappedErr.addSuppressed(e0); - - try { - return U.marshal(jdk(), wrappedErr); - } - catch (IgniteCheckedException e1) { - IgniteException marshErr = new IgniteException("Unable to marshal the wrapping error.", e1); - - marshErr.addSuppressed(wrappedErr); - - throw marshErr; - } - } + /** {@inheritDoc} */ + @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { + errBytes = U.marshal(marsh, err); } - /** - * Deserializes the error from {@code errBytes}. Should be called only once. - * - * @param errBytes Serialized error. - * @see MessageWriter - */ - public void errorBytes(@Nullable byte[] errBytes) { - if (F.isEmpty(errBytes)) - err = null; - else { - try { - err = U.unmarshal(jdk(), errBytes, U.gridClassLoader()); - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to unmarshal error data bytes.", e); - } - } + /** {@inheritDoc} */ + @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { + err = U.unmarshal(marsh, errBytes, clsLdr); } /** */ @@ -125,7 +69,7 @@ public void errorBytes(@Nullable byte[] errBytes) { } /** - * Safely gets original error from an error message. + * Error. * * @param errorMsg Error message. * @return Error containing in the message. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 07785b6913feb..6c715d7a24436 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -449,7 +449,7 @@ public void resetMetrics() { List compMsgs = new ArrayList<>(); - compMsgs.add(new GridIoMessageFactory()); + compMsgs.add(new GridIoMessageFactory(marsh, U.resolveClassLoader(ctx.config()))); for (IgniteComponentType compType : IgniteComponentType.values()) { MessageFactoryProvider f = compType.messageFactory(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java index 6baea4e7684bb..f70ec43d87e62 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java @@ -330,6 +330,7 @@ import org.apache.ignite.internal.util.UUIDCollectionMessage; import org.apache.ignite.internal.util.UUIDCollectionMessageSerializer; import org.apache.ignite.internal.util.distributed.SingleNodeMessage; +import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.collision.jobstealing.JobStealingRequest; @@ -345,17 +346,35 @@ import org.apache.ignite.spi.communication.tcp.messages.NodeIdMessageSerializer; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessageSerializer; +import org.jetbrains.annotations.Nullable; /** * Message factory implementation. */ public class GridIoMessageFactory implements MessageFactoryProvider { + /** Custom data marshaller. */ + private final @Nullable Marshaller cstDataMarshall; + + /** Class loader for the custom data marshalling. */ + private final @Nullable ClassLoader cstDataMarshallClsLdr; + + /** + * @param cstDataMarshall Custom data marshaller. + * @param cstDataMarshallClsLdr Class loader for the custom data marshalling. + */ + public GridIoMessageFactory(@Nullable Marshaller cstDataMarshall, @Nullable ClassLoader cstDataMarshallClsLdr) { + assert cstDataMarshall == null && cstDataMarshallClsLdr == null || cstDataMarshall != null && cstDataMarshallClsLdr != null; + + this.cstDataMarshall = cstDataMarshall; + this.cstDataMarshallClsLdr = cstDataMarshallClsLdr; + } + /** {@inheritDoc} */ @Override public void registerAll(MessageFactory factory) { // -54 is reserved for SQL. // We don't use the code‑generated serializer for CompressedMessage - serialization is highly customized. factory.register(CompressedMessage.TYPE_CODE, CompressedMessage::new); - factory.register((short)-66, ErrorMessage::new, new ErrorMessageSerializer()); + factory.register((short)-66, ErrorMessage::new, new ErrorMessageMarshallableSerializer(cstDataMarshall, cstDataMarshallClsLdr)); factory.register((short)-65, TxInfo::new, new TxInfoSerializer()); factory.register((short)-64, TxEntriesInfo::new, new TxEntriesInfoSerializer()); factory.register((short)-63, ExchangeInfo::new, new ExchangeInfoSerializer()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java index 1e31e1bf0790d..1412837916fa6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.managers.discovery; import org.apache.ignite.internal.managers.communication.ErrorMessage; -import org.apache.ignite.internal.managers.communication.ErrorMessageSerializer; +import org.apache.ignite.internal.managers.communication.ErrorMessageMarshallableSerializer; import org.apache.ignite.internal.processors.authentication.User; import org.apache.ignite.internal.processors.authentication.UserAcceptedMessage; import org.apache.ignite.internal.processors.authentication.UserAcceptedMessageSerializer; @@ -166,7 +166,7 @@ public DiscoveryMessageFactory(@Nullable Marshaller cstDataMarshall, @Nullable C factory.register((short)-102, TcpDiscoveryNodeMetricsMessage::new, new TcpDiscoveryNodeMetricsMessageSerializer()); factory.register((short)-101, InetSocketAddressMessage::new, new InetSocketAddressMessageSerializer()); factory.register((short)-100, InetAddressMessage::new, new InetAddressMessageSerializer()); - factory.register((short)-66, ErrorMessage::new, new ErrorMessageSerializer()); + factory.register((short)-66, ErrorMessage::new, new ErrorMessageMarshallableSerializer(cstDataMarshall, cstDataMarshallClsLdr)); // TcpDiscoveryAbstractMessage factory.register((short)0, TcpDiscoveryCheckFailedMessage::new, new TcpDiscoveryCheckFailedMessageSerializer()); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MarshallableMessage.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MarshallableMessage.java index f58e6cb324110..f3cc81dd68e26 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MarshallableMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MarshallableMessage.java @@ -17,12 +17,13 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.marshaller.Marshaller; /** A {@link Message} which still requires external custom pre-marshalling and post-unmarshalling. */ public interface MarshallableMessage extends Message { /** @param marsh External custom marshaller. */ - public default void prepareMarshal(Marshaller marsh) { + public default void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { throw new UnsupportedOperationException(); } @@ -30,7 +31,7 @@ public default void prepareMarshal(Marshaller marsh) { * @param marsh External custom marshaller. * @param clsLdr External class loader to post-unmarshall. */ - public default void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) { + public default void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { throw new UnsupportedOperationException(); } } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java index 9d18e1d5b3c37..280b384e6ff3b 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java @@ -21,7 +21,6 @@ import java.util.Objects; import java.util.UUID; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; import org.apache.ignite.internal.Order; import org.apache.ignite.internal.managers.discovery.DiscoveryMessageFactory; import org.apache.ignite.internal.util.tostring.GridToStringExclude; @@ -130,29 +129,13 @@ public boolean success() { } /** {@inheritDoc} */ - @Override public void prepareMarshal(Marshaller marsh) { - if (msgs != null && msgsBytes == null) { - try { - msgsBytes = U.marshal(marsh, msgs); - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to marshal the pending messages.", e); - } - } + @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { + msgsBytes = U.marshal(marsh, msgs); } /** {@inheritDoc} */ - @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) { - if (msgsBytes != null && msgs == null) { - try { - msgs = U.unmarshal(marsh, msgsBytes, clsLdr); - - msgsBytes = null; - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to unmarshal the pending messages.", e); - } - } + @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { + msgs = U.unmarshal(marsh, msgsBytes, clsLdr); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java index 8932c3f7af901..1c26b0ae58830 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java @@ -18,7 +18,6 @@ package org.apache.ignite.spi.discovery.tcp.messages; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; import org.apache.ignite.internal.Order; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; @@ -96,29 +95,13 @@ public void responded(boolean responded) { } /** {@inheritDoc} */ - @Override public void prepareMarshal(Marshaller marsh) { - if (node != null && nodeBytes == null) { - try { - nodeBytes = U.marshal(marsh, node); - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to marshal TcpDiscoveryNode object", e); - } - } + @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { + nodeBytes = U.marshal(marsh, node); } /** {@inheritDoc} */ - @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) { - if (nodeBytes != null && node == null) { - try { - node = U.unmarshal(marsh, nodeBytes, clsLdr); - - nodeBytes = null; - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to unmarshal TcpDiscoveryNode object", e); - } - } + @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { + node = U.unmarshal(marsh, nodeBytes, clsLdr); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java index 820c42156b53e..00b7eaaa0f42d 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java @@ -20,7 +20,6 @@ import java.util.Map; import java.util.UUID; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; import org.apache.ignite.internal.Order; import org.apache.ignite.internal.util.tostring.GridToStringExclude; import org.apache.ignite.internal.util.typedef.internal.S; @@ -127,29 +126,13 @@ public void clientNodeAttributes(Map clientNodeAttrs) { } /** {@inheritDoc} */ - @Override public void prepareMarshal(Marshaller marsh) { - if (clientNodeAttrs != null && clientNodeAttrsBytes == null) { - try { - clientNodeAttrsBytes = U.marshal(marsh, clientNodeAttrs); - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to marshal client node attributes.", e); - } - } + @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { + clientNodeAttrsBytes = U.marshal(marsh, clientNodeAttrs); } /** {@inheritDoc} */ - @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) { - if (clientNodeAttrsBytes != null && clientNodeAttrs == null) { - try { - clientNodeAttrs = U.unmarshal(marsh, clientNodeAttrsBytes, clsLdr); - - clientNodeAttrsBytes = null; - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to unmarshal client node attributes.", e); - } - } + @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { + clientNodeAttrs = U.unmarshal(marsh, clientNodeAttrsBytes, clsLdr); } /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/direct/DirectMarshallingMessagesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/direct/DirectMarshallingMessagesTest.java index 3c07575f8b44a..d3fb2b64dbd0d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/direct/DirectMarshallingMessagesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/direct/DirectMarshallingMessagesTest.java @@ -23,6 +23,7 @@ import org.apache.ignite.internal.managers.communication.GridIoMessageFactory; import org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl; import org.apache.ignite.internal.util.distributed.SingleNodeMessage; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; @@ -30,6 +31,7 @@ import org.junit.Test; import static org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.TEST_PROCESS; +import static org.apache.ignite.marshaller.Marshallers.jdk; /** * Messages marshalling test. @@ -37,7 +39,7 @@ public class DirectMarshallingMessagesTest extends GridCommonAbstractTest { /** Message factory. */ private final MessageFactory msgFactory = - new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {new GridIoMessageFactory()}); + new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader())}); /** */ @Test diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java index 270fe7e47b37d..cadfc81088402 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java @@ -37,6 +37,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.junit.Test; +import static org.apache.ignite.marshaller.Marshallers.jdk; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -45,7 +46,7 @@ public class CompressedMessageTest { /** */ @Test public void testWriteReadHugeMessage() { - MessageFactory msgFactory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory()}); + MessageFactory msgFactory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(jdk(), U.gridClassLoader())}); DirectMessageWriter writer = new DirectMessageWriter(msgFactory); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/ErrorMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/ErrorMessageSelfTest.java index 8463e67df6313..b3ff36de94b8a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/ErrorMessageSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/ErrorMessageSelfTest.java @@ -20,8 +20,10 @@ import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.internal.util.typedef.X; +import org.apache.ignite.internal.util.typedef.internal.U; import org.junit.Test; +import static org.apache.ignite.marshaller.Marshallers.jdk; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; @@ -31,20 +33,24 @@ public class ErrorMessageSelfTest { /** */ @Test - public void testDirectAndInsverseConversion() { + public void testDirectAndInsverseConversion() throws IgniteCheckedException { IgniteException e = new IgniteException("Test exception", new IgniteCheckedException("Test cause")); ErrorMessage msg0 = new ErrorMessage(e); - + assertSame(e, msg0.error()); - byte[] errBytes = msg0.errorBytes(); + msg0.prepareMarshal(jdk()); + + byte[] errBytes = msg0.errBytes; assertNotNull(errBytes); ErrorMessage msg1 = new ErrorMessage(); - msg1.errorBytes(errBytes); - + msg1.errBytes = errBytes; + + msg1.finishUnmarshal(jdk(), U.gridClassLoader()); + Throwable t = msg1.error(); assertNotNull(t); @@ -56,13 +62,13 @@ public void testDirectAndInsverseConversion() { @Test public void testNull() { assertNull(new ErrorMessage(null).error()); - assertNull(new ErrorMessage(null).errorBytes()); + assertNull(new ErrorMessage(null).errBytes); ErrorMessage msg = new ErrorMessage(); - msg.errorBytes(null); + msg.errBytes = null; assertNull(msg.error()); - assertNull(msg.errorBytes()); + assertNull(msg.errBytes); } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteIoCommunicationMessageSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteIoCommunicationMessageSerializationTest.java index a05bb4e9ac693..3f2a942ddb1ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteIoCommunicationMessageSerializationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteIoCommunicationMessageSerializationTest.java @@ -20,18 +20,20 @@ import java.util.UUID; import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.ignite.internal.processors.cache.distributed.dht.PartitionUpdateCountersMessage; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.communication.tcp.messages.NodeIdMessage; import static org.apache.ignite.internal.util.IgniteUtils.toBytes; +import static org.apache.ignite.marshaller.Marshallers.jdk; /** */ public class IgniteIoCommunicationMessageSerializationTest extends AbstractMessageSerializationTest { /** {@inheritDoc} */ @Override protected MessageFactoryProvider messageFactory() { - return new GridIoMessageFactory(); + return new GridIoMessageFactory(jdk(), U.gridClassLoader()); } /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java index 7dc74b73de6ee..e75ed12f40019 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java @@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.CacheObjectImpl; import org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -44,6 +45,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; +import static org.apache.ignite.marshaller.Marshallers.jdk; /** * @@ -148,7 +150,7 @@ public void testCacheContinuousQueryEntrySerialization() { e0.markFiltered(); IgniteMessageFactoryImpl msgFactory = - new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory()}); + new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(jdk(), U.gridClassLoader())}); ByteBuffer buf = ByteBuffer.allocate(4096); DirectMessageWriter writer = new DirectMessageWriter(msgFactory); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java index 3427867c84faf..9ccc5fd9ceeeb 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java @@ -47,6 +47,7 @@ import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS; +import static org.apache.ignite.marshaller.Marshallers.jdk; /** * Super class for all communication self tests. @@ -160,7 +161,7 @@ private void startSpis() throws Exception { } }; - ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {new GridIoMessageFactory(), testMsgFactory})); + ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java index b2ee543a8cb23..54c6a40c1fa96 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java @@ -64,6 +64,8 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest; import org.junit.Test; +import static org.apache.ignite.marshaller.Marshallers.jdk; + /** * */ @@ -438,7 +440,7 @@ private void startSpis(MessageListener lsnr) throws Exception { }; ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java index d4d63ac7e6676..45a9020c84688 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java @@ -58,6 +58,7 @@ import static org.apache.ignite.IgniteSystemProperties.getBoolean; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS; import static org.apache.ignite.internal.util.IgniteUtils.spiAttribute; +import static org.apache.ignite.marshaller.Marshallers.jdk; import static org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.ATTR_HOST_NAMES; import static org.apache.ignite.testframework.GridTestUtils.getFreeCommPort; @@ -251,7 +252,7 @@ private TcpCommunicationSpi initializeSpi(GridSpiTestContext ctx, MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(), testMsgFactory})); + ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java index 976108cef7ad9..2d08829de4352 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java @@ -64,6 +64,7 @@ import org.junit.Test; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS; +import static org.apache.ignite.marshaller.Marshallers.jdk; /** * Class for multithreaded {@link TcpCommunicationSpi} test. @@ -468,7 +469,7 @@ private int getSpiCount() { MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) ); ctx.timeoutProcessor(timeoutProcessor); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java index 479c300a2632f..d9673085e92fa 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java @@ -55,6 +55,8 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest; import org.junit.Test; +import static org.apache.ignite.marshaller.Marshallers.jdk; + /** * */ @@ -404,7 +406,7 @@ private void startSpis(int ackCnt, int idleTimeout, int queueLimit) throws Excep }; ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java index c1cf05bea13dc..2169a66915fac 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java @@ -59,6 +59,8 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest; import org.junit.Test; +import static org.apache.ignite.marshaller.Marshallers.jdk; + /** * */ @@ -728,7 +730,7 @@ private void startSpis() throws Exception { MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java index d6e406bf91ad5..de813ed505d3f 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java @@ -58,6 +58,8 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest; import org.junit.Test; +import static org.apache.ignite.marshaller.Marshallers.jdk; + /** * */ @@ -457,7 +459,7 @@ private void startSpis(int ackCnt, int idleTimeout, int queueLimit) throws Excep }; ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java index 651c8e099d50e..8809b1c204b41 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java @@ -52,6 +52,7 @@ import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.logger.NullLogger; @@ -75,6 +76,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT; import static org.apache.ignite.events.EventType.EVT_NODE_METRICS_UPDATED; import static org.apache.ignite.internal.GridTopic.TOPIC_COMM_USER; +import static org.apache.ignite.marshaller.Marshallers.jdk; /** * Test SPI context. @@ -552,7 +554,7 @@ public void triggerEvent(Event evt) { /** {@inheritDoc} */ @Override public MessageFactory messageFactory() { if (factory == null) - factory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory()}); + factory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(jdk(), U.gridClassLoader())}); return factory; } diff --git a/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshallableSerializer.java b/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshallableSerializer.java index 365ec8b80bf7e..80602f050ee7d 100644 --- a/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshallableSerializer.java +++ b/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshallableSerializer.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteException; import org.apache.ignite.internal.TestMarshallableMessage; import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.plugin.extensions.communication.MessageReader; @@ -45,7 +47,12 @@ public TestMarshallableMessageMarshallableSerializer(Marshaller marshaller, Clas if (!writer.writeHeader(msg.directType())) return false; - msg.prepareMarshal(marshaller); + try { + msg.prepareMarshal(marshaller); + } + catch (IgniteCheckedException e) { + throw new IgniteException("Failed to marshal object", e); + } writer.onHeaderWritten(); } @@ -101,8 +108,13 @@ public TestMarshallableMessageMarshallableSerializer(Marshaller marshaller, Clas reader.incrementState(); } - msg.finishUnmarshal(marshaller, clsLdr); + try { + msg.finishUnmarshal(marshaller, clsLdr); + } + catch (IgniteCheckedException e) { + throw new IgniteException("Failed to unmarshal object", e); + } return true; } -} \ No newline at end of file +} From e0996f4ad790c27719028e0791a7f1e6c4ad8844 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Wed, 11 Mar 2026 18:00:35 +0300 Subject: [PATCH 02/12] WIP --- .../communication/CompressedMessageTest.java | 3 ++- .../GridAbstractCommunicationSelfTest.java | 3 ++- ...GridTcpCommunicationSpiConfigSelfTest.java | 3 ++- .../codegen/TestMarshallableMessage.java | 24 ++++--------------- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java index cadfc81088402..e5d8ca1930798 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java @@ -46,7 +46,8 @@ public class CompressedMessageTest { /** */ @Test public void testWriteReadHugeMessage() { - MessageFactory msgFactory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(jdk(), U.gridClassLoader())}); + MessageFactory msgFactory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{ + new GridIoMessageFactory(jdk(), U.gridClassLoader())}); DirectMessageWriter writer = new DirectMessageWriter(msgFactory); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java index 9ccc5fd9ceeeb..b2b94378e982e 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java @@ -161,7 +161,8 @@ private void startSpis() throws Exception { } }; - ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); + ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[] { + new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java index 45a9020c84688..11a00c77265e8 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java @@ -252,7 +252,8 @@ private TcpCommunicationSpi initializeSpi(GridSpiTestContext ctx, MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); + ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{ + new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); ctx.setLocalNode(node); diff --git a/modules/core/src/test/resources/codegen/TestMarshallableMessage.java b/modules/core/src/test/resources/codegen/TestMarshallableMessage.java index 58a871692d3ac..7d33f076d889a 100644 --- a/modules/core/src/test/resources/codegen/TestMarshallableMessage.java +++ b/modules/core/src/test/resources/codegen/TestMarshallableMessage.java @@ -43,29 +43,13 @@ public class TestMarshallableMessage implements MarshallableMessage { byte[] cstDataBytes; /** {@inheritDoc} */ - @Override public void prepareMarshal(Marshaller marsh) { - if (cstData != null && cstDataBytes == null) { - try { - cstDataBytes = U.marshal(marsh, cstData); - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to marshal custom data.", e); - } - } + @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { + cstDataBytes = U.marshal(marsh, cstData); } /** {@inheritDoc} */ - @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) { - if (cstDataBytes != null && cstData == null) { - try { - cstData = U.unmarshal(marsh, cstDataBytes, clsLdr); - - cstDataBytes = null; - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to unmarshal custom data.", e); - } - } + @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { + cstData = U.unmarshal(marsh, cstDataBytes, clsLdr); } public short directType() { From 3e1b38377fb5349c8566d1870033507f305f3f3f Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Wed, 11 Mar 2026 18:35:53 +0300 Subject: [PATCH 03/12] WIP --- .../calcite/message/CalciteErrorMessage.java | 34 ++++++++++++++++--- .../query/calcite/message/MessageType.java | 5 +-- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java index 99695f9cf1ac8..456f3487bdfda 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java @@ -18,13 +18,17 @@ package org.apache.ignite.internal.processors.query.calcite.message; import java.util.UUID; +import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.Order; -import org.apache.ignite.internal.managers.communication.ErrorMessage; +import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; +import org.apache.ignite.internal.util.tostring.GridToStringExclude; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.jetbrains.annotations.Nullable; /** * */ -public class CalciteErrorMessage extends ErrorMessage implements CalciteMessage { +public class CalciteErrorMessage implements CalciteMarshalableMessage { /** */ @Order(0) UUID qryId; @@ -33,6 +37,14 @@ public class CalciteErrorMessage extends ErrorMessage implements CalciteMessage @Order(1) long fragmentId; + /** Error bytes. */ + @Order(2) + @GridToStringExclude + @Nullable public byte[] errBytes; + + /** Error. */ + private @Nullable Throwable err; + /** */ public CalciteErrorMessage() { // No-op. @@ -40,12 +52,11 @@ public CalciteErrorMessage() { /** */ public CalciteErrorMessage(UUID qryId, long fragmentId, Throwable err) { - super(err); - assert err != null; this.qryId = qryId; this.fragmentId = fragmentId; + this.err = err; } /** @@ -62,6 +73,11 @@ public long fragmentId() { return fragmentId; } + /** */ + public @Nullable Throwable error() { + return err; + } + /** {@inheritDoc} */ @Override public MessageType type() { return MessageType.QUERY_ERROR_MESSAGE; @@ -71,4 +87,14 @@ public long fragmentId() { @Override public short directType() { return MessageType.QUERY_ERROR_MESSAGE.directType(); } + + /** {@inheritDoc} */ + @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { + errBytes = U.marshal(ctx.marshaller(), err); + } + + /** {@inheritDoc} */ + @Override public void prepareUnmarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { + err = U.unmarshal(ctx.marshaller(), errBytes, U.resolveClassLoader(ctx.cache().context().gridConfig())); + } } diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java index 75aeb4bb5297c..44438a8d4892b 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageType.java @@ -24,11 +24,8 @@ import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentDescriptionSerializer; import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentMapping; import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentMappingSerializer; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.MessageSerializer; -import static org.apache.ignite.marshaller.Marshallers.jdk; - /** * */ @@ -40,7 +37,7 @@ public enum MessageType { QUERY_START_RESPONSE(301, QueryStartResponse::new, new QueryStartResponseSerializer()), /** */ - QUERY_ERROR_MESSAGE(302, CalciteErrorMessage::new, new CalciteErrorMessageMarshallableSerializer(jdk(), U.gridClassLoader())), + QUERY_ERROR_MESSAGE(302, CalciteErrorMessage::new, new CalciteErrorMessageSerializer()), /** */ QUERY_BATCH_MESSAGE(303, QueryBatchMessage::new, new QueryBatchMessageSerializer()), From 4d1d8f7ed5c172f104a23c2f664c9d55104e51b1 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Thu, 12 Mar 2026 15:58:16 +0300 Subject: [PATCH 04/12] WIP --- .../internal/managers/communication/ErrorMessage.java | 6 ++++-- .../tcp/messages/TcpDiscoveryClientReconnectMessage.java | 6 ++++-- .../tcp/messages/TcpDiscoveryJoinRequestMessage.java | 6 ++++-- .../tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java index 917136ba2df5b..082f7c45987e4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java @@ -55,12 +55,14 @@ public ErrorMessage(@Nullable Throwable err) { /** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { - errBytes = U.marshal(marsh, err); + if (err != null) + errBytes = U.marshal(marsh, err); } /** {@inheritDoc} */ @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { - err = U.unmarshal(marsh, errBytes, clsLdr); + if (errBytes != null) + err = U.unmarshal(marsh, errBytes, clsLdr); } /** */ diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java index 280b384e6ff3b..3eaf562e5a7fb 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java @@ -130,12 +130,14 @@ public boolean success() { /** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { - msgsBytes = U.marshal(marsh, msgs); + if (msgs != null) + msgsBytes = U.marshal(marsh, msgs); } /** {@inheritDoc} */ @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { - msgs = U.unmarshal(marsh, msgsBytes, clsLdr); + if (msgsBytes != null) + msgs = U.unmarshal(marsh, msgsBytes, clsLdr); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java index 1c26b0ae58830..1e39d5b29fe2d 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java @@ -96,12 +96,14 @@ public void responded(boolean responded) { /** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { - nodeBytes = U.marshal(marsh, node); + if (node != null) + nodeBytes = U.marshal(marsh, node); } /** {@inheritDoc} */ @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { - node = U.unmarshal(marsh, nodeBytes, clsLdr); + if (nodeBytes != null) + node = U.unmarshal(marsh, nodeBytes, clsLdr); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java index 00b7eaaa0f42d..451689eabe008 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java @@ -127,12 +127,14 @@ public void clientNodeAttributes(Map clientNodeAttrs) { /** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { - clientNodeAttrsBytes = U.marshal(marsh, clientNodeAttrs); + if (clientNodeAttrs != null) + clientNodeAttrsBytes = U.marshal(marsh, clientNodeAttrs); } /** {@inheritDoc} */ @Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException { - clientNodeAttrs = U.unmarshal(marsh, clientNodeAttrsBytes, clsLdr); + if (clientNodeAttrsBytes != null) + clientNodeAttrs = U.unmarshal(marsh, clientNodeAttrsBytes, clsLdr); } /** {@inheritDoc} */ From 5271be4696890c4c2e34c48ec49f5b3470fa6f3e Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Thu, 12 Mar 2026 16:08:25 +0300 Subject: [PATCH 05/12] WIP --- .../managers/communication/GridIoMessageFactory.java | 10 ++++------ .../managers/discovery/DiscoveryMessageFactory.java | 10 ++++------ .../IgniteDiscoveryMessageSerializationTest.java | 5 ++++- .../discovery/zk/internal/DiscoveryMessageParser.java | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java index f70ec43d87e62..7765a8c45f120 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java @@ -346,25 +346,23 @@ import org.apache.ignite.spi.communication.tcp.messages.NodeIdMessageSerializer; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessageSerializer; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * Message factory implementation. */ public class GridIoMessageFactory implements MessageFactoryProvider { /** Custom data marshaller. */ - private final @Nullable Marshaller cstDataMarshall; + private final @NotNull Marshaller cstDataMarshall; /** Class loader for the custom data marshalling. */ - private final @Nullable ClassLoader cstDataMarshallClsLdr; + private final @NotNull ClassLoader cstDataMarshallClsLdr; /** * @param cstDataMarshall Custom data marshaller. * @param cstDataMarshallClsLdr Class loader for the custom data marshalling. */ - public GridIoMessageFactory(@Nullable Marshaller cstDataMarshall, @Nullable ClassLoader cstDataMarshallClsLdr) { - assert cstDataMarshall == null && cstDataMarshallClsLdr == null || cstDataMarshall != null && cstDataMarshallClsLdr != null; - + public GridIoMessageFactory(@NotNull Marshaller cstDataMarshall, @NotNull ClassLoader cstDataMarshallClsLdr) { this.cstDataMarshall = cstDataMarshall; this.cstDataMarshallClsLdr = cstDataMarshallClsLdr; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java index 1412837916fa6..fde54ddbc1d27 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java @@ -132,23 +132,21 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryServerOnlyCustomEventMessageSerializer; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusCheckMessage; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusCheckMessageSerializer; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** Message factory for discovery messages. */ public class DiscoveryMessageFactory implements MessageFactoryProvider { /** Custom data marshaller. */ - private final @Nullable Marshaller cstDataMarshall; + private final @NotNull Marshaller cstDataMarshall; /** Class loader for the custom data marshalling. */ - private final @Nullable ClassLoader cstDataMarshallClsLdr; + private final @NotNull ClassLoader cstDataMarshallClsLdr; /** * @param cstDataMarshall Custom data marshaller. * @param cstDataMarshallClsLdr Class loader for the custom data marshalling. */ - public DiscoveryMessageFactory(@Nullable Marshaller cstDataMarshall, @Nullable ClassLoader cstDataMarshallClsLdr) { - assert cstDataMarshall == null && cstDataMarshallClsLdr == null || cstDataMarshall != null && cstDataMarshallClsLdr != null; - + public DiscoveryMessageFactory(@NotNull Marshaller cstDataMarshall, @NotNull ClassLoader cstDataMarshallClsLdr) { this.cstDataMarshall = cstDataMarshall; this.cstDataMarshallClsLdr = cstDataMarshallClsLdr; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteDiscoveryMessageSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteDiscoveryMessageSerializationTest.java index f6eaab9c754ce..b37398fa1393b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteDiscoveryMessageSerializationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteDiscoveryMessageSerializationTest.java @@ -18,12 +18,15 @@ package org.apache.ignite.internal.managers.discovery; import org.apache.ignite.internal.managers.communication.AbstractMessageSerializationTest; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; +import static org.apache.ignite.marshaller.Marshallers.jdk; + /** Serialization test for discovery messages. */ public class IgniteDiscoveryMessageSerializationTest extends AbstractMessageSerializationTest { /** {@inheritDoc} */ @Override protected MessageFactoryProvider messageFactory() { - return new DiscoveryMessageFactory(null, null); + return new DiscoveryMessageFactory(jdk(), U.gridClassLoader()); } } diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/DiscoveryMessageParser.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/DiscoveryMessageParser.java index bd2dd5857b52c..790a573df4a26 100644 --- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/DiscoveryMessageParser.java +++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/DiscoveryMessageParser.java @@ -66,7 +66,7 @@ public class DiscoveryMessageParser { public DiscoveryMessageParser(Marshaller marsh) { this.marsh = marsh; this.msgFactory = new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] { new DiscoveryMessageFactory(null, null) }); + new MessageFactoryProvider[] { new DiscoveryMessageFactory(marsh, U.gridClassLoader()) }); } /** Marshals discovery message to bytes array. */ From 13113129a14d780dd24d8fcf71d340f3beb81fd5 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Thu, 12 Mar 2026 16:34:53 +0300 Subject: [PATCH 06/12] WIP --- .../ignite/internal/managers/communication/GridIoManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 6c715d7a24436..446546b8962e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -449,7 +449,7 @@ public void resetMetrics() { List compMsgs = new ArrayList<>(); - compMsgs.add(new GridIoMessageFactory(marsh, U.resolveClassLoader(ctx.config()))); + compMsgs.add(new GridIoMessageFactory(marsh, U.gridClassLoader())); for (IgniteComponentType compType : IgniteComponentType.values()) { MessageFactoryProvider f = compType.messageFactory(); From 10064badb766c6fb7aa7685e97f82c019b14f4c7 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Thu, 12 Mar 2026 21:04:40 +0300 Subject: [PATCH 07/12] WIP --- .../managers/communication/ErrorMessage.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java index 082f7c45987e4..875fee0b2be48 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java @@ -55,8 +55,18 @@ public ErrorMessage(@Nullable Throwable err) { /** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { - if (err != null) - errBytes = U.marshal(marsh, err); + try { + if (err != null) + errBytes = U.marshal(marsh, err); + } + catch (IgniteCheckedException e) { + IgniteCheckedException wrappedErr = new IgniteCheckedException(err.getMessage()); + + wrappedErr.setStackTrace(err.getStackTrace()); + wrappedErr.addSuppressed(e); + + errBytes = U.marshal(marsh, wrappedErr); + } } /** {@inheritDoc} */ From 9349d55d26fc76fd76464e007327842b5fc2eea6 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Thu, 12 Mar 2026 22:59:32 +0300 Subject: [PATCH 08/12] WIP --- .../query/calcite/message/CalciteErrorMessage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java index 456f3487bdfda..702580e51954b 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteErrorMessage.java @@ -90,11 +90,13 @@ public long fragmentId() { /** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { - errBytes = U.marshal(ctx.marshaller(), err); + if (err != null) + errBytes = U.marshal(ctx.marshaller(), err); } /** {@inheritDoc} */ @Override public void prepareUnmarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { - err = U.unmarshal(ctx.marshaller(), errBytes, U.resolveClassLoader(ctx.cache().context().gridConfig())); + if (errBytes != null) + err = U.unmarshal(ctx.marshaller(), errBytes, U.resolveClassLoader(ctx.cache().context().gridConfig())); } } From 5ffcb2206971066ad1bee5934c761a9435dd64fb Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Fri, 13 Mar 2026 18:56:48 +0300 Subject: [PATCH 09/12] WIP --- .../apache/ignite/internal/MessageSerializerGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java index 8cb762250d4e7..723adfd985253 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java @@ -298,7 +298,7 @@ private void start(Collection code, boolean write) { indent++; - code.add(identedLine("throw new IgniteException(\"Failed to marshal object\", e);")); + code.add(identedLine("throw new IgniteException(\"Failed to marshal object\" + msg.getClass().getSimpleName(), e);")); indent--; @@ -985,7 +985,7 @@ private void finish(List code, boolean read, boolean marshallable) { indent++; - code.add(identedLine("throw new IgniteException(\"Failed to unmarshal object\", e);")); + code.add(identedLine("throw new IgniteException(\"Failed to unmarshal object\" + msg.getClass().getSimpleName(), e);")); indent--; From 769bd080d0048e661540f6f77bb10819c4a2c3c9 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Fri, 13 Mar 2026 19:00:53 +0300 Subject: [PATCH 10/12] WIP --- .../ignite/internal/managers/communication/ErrorMessage.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java index 875fee0b2be48..990e681215ac7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java @@ -81,8 +81,6 @@ public ErrorMessage(@Nullable Throwable err) { } /** - * Error. - * * @param errorMsg Error message. * @return Error containing in the message. */ From 2aae0b5d574f988a45a1c256d50f3b3e48606185 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Fri, 13 Mar 2026 19:03:28 +0300 Subject: [PATCH 11/12] WIP --- .../managers/discovery/DiscoveryMessageFactory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java index fde54ddbc1d27..3969c9dd31776 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryMessageFactory.java @@ -132,21 +132,20 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryServerOnlyCustomEventMessageSerializer; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusCheckMessage; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusCheckMessageSerializer; -import org.jetbrains.annotations.NotNull; /** Message factory for discovery messages. */ public class DiscoveryMessageFactory implements MessageFactoryProvider { /** Custom data marshaller. */ - private final @NotNull Marshaller cstDataMarshall; + private final Marshaller cstDataMarshall; /** Class loader for the custom data marshalling. */ - private final @NotNull ClassLoader cstDataMarshallClsLdr; + private final ClassLoader cstDataMarshallClsLdr; /** * @param cstDataMarshall Custom data marshaller. * @param cstDataMarshallClsLdr Class loader for the custom data marshalling. */ - public DiscoveryMessageFactory(@NotNull Marshaller cstDataMarshall, @NotNull ClassLoader cstDataMarshallClsLdr) { + public DiscoveryMessageFactory(Marshaller cstDataMarshall, ClassLoader cstDataMarshallClsLdr) { this.cstDataMarshall = cstDataMarshall; this.cstDataMarshallClsLdr = cstDataMarshallClsLdr; } From f2ccbe71dc76005b875099f3e8567c7f745e02c2 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Fri, 13 Mar 2026 19:13:28 +0300 Subject: [PATCH 12/12] WIP --- .../managers/communication/GridIoMessageFactory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java index 7765a8c45f120..eb022f0edb1bd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java @@ -346,23 +346,22 @@ import org.apache.ignite.spi.communication.tcp.messages.NodeIdMessageSerializer; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessageSerializer; -import org.jetbrains.annotations.NotNull; /** * Message factory implementation. */ public class GridIoMessageFactory implements MessageFactoryProvider { /** Custom data marshaller. */ - private final @NotNull Marshaller cstDataMarshall; + private final Marshaller cstDataMarshall; /** Class loader for the custom data marshalling. */ - private final @NotNull ClassLoader cstDataMarshallClsLdr; + private final ClassLoader cstDataMarshallClsLdr; /** * @param cstDataMarshall Custom data marshaller. * @param cstDataMarshallClsLdr Class loader for the custom data marshalling. */ - public GridIoMessageFactory(@NotNull Marshaller cstDataMarshall, @NotNull ClassLoader cstDataMarshallClsLdr) { + public GridIoMessageFactory(Marshaller cstDataMarshall, ClassLoader cstDataMarshallClsLdr) { this.cstDataMarshall = cstDataMarshall; this.cstDataMarshallClsLdr = cstDataMarshallClsLdr; }