You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2026/08/14 19:46:11 UTC
(ignite) branch master updated: IGNITE-28940 Choose the marshaller by transport, not by message class (#13462)
This is an automated email from the ASF dual-hosted git repository.
anton-vinogradov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 3c6463f1ec2 IGNITE-28940 Choose the marshaller by transport, not by message class (#13462)
3c6463f1ec2 is described below
commit 3c6463f1ec2652eadd9493bc0823c988166490f2
Author: Anton Vinogradov <av...@apache.org>
AuthorDate: Fri Aug 14 22:46:04 2026 +0300
IGNITE-28940 Choose the marshaller by transport, not by message class (#13462)
---
.../direct/JmhDirectMessageReaderBenchmark.java | 3 +-
.../query/calcite/message/GenericValueMessage.java | 2 -
.../query/calcite/message/MessageServiceImpl.java | 4 +-
.../query/calcite/message/QueryStartRequest.java | 2 -
.../calcite/exec/rel/ContinuousExecutionTest.java | 3 -
...lciteCommunicationMessageSerializationTest.java | 3 -
.../query/calcite/planner/PlanExecutionTest.java | 3 -
.../org/apache/ignite/internal/JdkMarshalled.java} | 26 +-
.../internal/MessageMarshallerGenerator.java | 100 ++++---
.../ignite/internal/CoreMessagesProvider.java | 14 -
.../ignite/internal/GridJobExecuteRequest.java | 1 -
.../ignite/internal/GridJobExecuteResponse.java | 1 -
.../ignite/internal/GridTaskSessionRequest.java | 1 -
.../apache/ignite/internal/GridTopicMessage.java | 1 -
.../ignite/internal/IgniteDiagnosticRequest.java | 1 -
.../org/apache/ignite/internal/IgniteKernal.java | 18 +-
.../org/apache/ignite/internal/TxEntriesInfo.java | 1 -
.../communication/CommunicationMarshalling.java | 61 ++++
.../communication/DiscoveryMarshalling.java | 52 ++++
.../managers/communication/GridIoManager.java | 10 +-
.../managers/communication/GridIoUserMessage.java | 2 -
.../managers/communication/MessageMarshalling.java | 44 +--
.../managers/eventstorage/EventsDataBagItem.java | 2 -
.../eventstorage/GridEventStorageManager.java | 4 +-
.../eventstorage/GridEventStorageRequest.java | 2 -
.../eventstorage/GridEventStorageResponse.java | 2 -
.../plugin/AbstractMessageFactoryProvider.java | 51 +---
.../cache/CacheEntryPredicateAdapter.java | 2 -
.../processors/cache/CacheEvictionEntry.java | 2 -
.../processors/cache/CacheInvokeDirectResult.java | 2 -
.../processors/cache/GridCacheIoManager.java | 4 +-
.../internal/processors/cache/GridCacheReturn.java | 2 -
.../internal/processors/cache/StoredCacheData.java | 4 +
.../cache/binary/BinaryMetadataVersionInfo.java | 6 +-
.../distributed/GridCacheTtlUpdateRequest.java | 2 -
.../distributed/GridDistributedLockRequest.java | 2 -
.../distributed/GridDistributedLockResponse.java | 2 -
.../GridDistributedTxPrepareRequest.java | 2 -
.../cache/distributed/GridNearUnlockRequest.java | 2 -
.../cache/distributed/dht/GridDhtLockRequest.java | 2 -
.../cache/distributed/dht/GridDhtLockResponse.java | 2 -
.../distributed/dht/GridDhtTxFinishResponse.java | 2 -
.../distributed/dht/GridDhtTxPrepareRequest.java | 2 -
.../distributed/dht/GridDhtTxPrepareResponse.java | 2 -
.../distributed/dht/GridDhtUnlockRequest.java | 2 -
.../dht/TransactionAttributesAwareRequest.java | 2 -
.../AtomicApplicationAttributesAwareRequest.java | 2 -
.../atomic/GridDhtAtomicSingleUpdateRequest.java | 2 -
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 2 -
.../atomic/GridNearAtomicFullUpdateRequest.java | 2 -
.../GridNearAtomicSingleUpdateFilterRequest.java | 2 -
.../GridNearAtomicSingleUpdateInvokeRequest.java | 2 -
.../atomic/GridNearAtomicSingleUpdateRequest.java | 2 -
.../dht/atomic/GridNearAtomicUpdateResponse.java | 2 -
.../distributed/dht/atomic/NearCacheUpdates.java | 2 -
.../cache/distributed/dht/atomic/UpdateErrors.java | 2 -
.../dht/preloader/GridDhtForceKeysRequest.java | 2 -
.../dht/preloader/GridDhtForceKeysResponse.java | 2 -
.../preloader/GridDhtPartitionSupplyMessage.java | 2 -
.../preloader/GridDhtPartitionsExchangeFuture.java | 4 +-
.../cache/distributed/near/GridNearGetRequest.java | 2 -
.../distributed/near/GridNearGetResponse.java | 2 -
.../distributed/near/GridNearSingleGetRequest.java | 2 -
.../near/GridNearSingleGetResponse.java | 2 -
.../near/GridNearTxPrepareResponse.java | 2 -
.../cache/query/GridCacheQueryRequest.java | 2 -
.../cache/query/GridCacheQueryResponse.java | 2 -
.../continuous/CacheContinuousQueryEntry.java | 2 -
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../cache/transactions/IgniteTxEntry.java | 2 -
.../processors/cache/transactions/IgniteTxKey.java | 2 -
.../cache/transactions/IgniteTxManager.java | 4 +-
.../cache/transactions/TxEntryValueHolder.java | 2 -
.../cache/transactions/TxLocksRequest.java | 2 -
.../cache/transactions/TxLocksResponse.java | 2 -
.../cache/verify/PartitionHashRecord.java | 9 +-
.../cache/verify/TransactionsHashRecord.java | 9 +-
.../datastreamer/DataStreamProcessor.java | 4 +-
.../processors/datastreamer/DataStreamerEntry.java | 2 -
.../datastreamer/DataStreamerReceiverMessage.java | 2 -
.../internal/processors/job/GridJobProcessor.java | 8 +-
.../internal/processors/job/GridJobWorker.java | 8 +-
.../rest/handlers/task/GridTaskResultResponse.java | 2 -
.../service/ServiceSingleNodeDeploymentResult.java | 2 -
.../internal/processors/task/GridTaskWorker.java | 4 +-
.../apache/ignite/internal/util/ErrorMessage.java | 5 +
.../util/distributed/SingleNodeMessage.java | 5 +
.../communication/MessageMarshaller.java | 17 +-
.../spi/discovery/tcp/TcpDiscoveryIoSession.java | 11 +-
.../internal/codegen/MessageProcessorTest.java | 17 ++
.../direct/DirectMarshallingMessagesTest.java | 3 +-
.../IgniteCoreMessagesSerializationTest.java | 3 +-
.../communication/CompressedMessageTest.java | 3 +-
.../GridIoManagerOrderedUnmarshalFailureTest.java | 7 +-
...MessageFactoryMarshallerInitializationTest.java | 138 ---------
.../query/GridCacheQueryResponseUnmarshalTest.java | 6 +-
...niteCacheContinuousQueryImmutableEntryTest.java | 3 +-
.../TxDeadlockDetectionMessageMarshallingTest.java | 8 +-
.../datastreamer/DataStreamerImplSelfTest.java | 4 +-
.../QueryEntityMessageSerializationTest.java | 14 +-
...rviceConfigurationMessageSerializationTest.java | 14 +-
.../DistributedProcessResultMarshallingTest.java | 323 +++++++++++++++++++++
.../communication/MessageMarshalOnceTest.java | 13 +-
...ecurityBasicPermissionSetSerializationTest.java | 3 +-
.../apache/ignite/spi/MessagesPluginProvider.java | 20 +-
.../GridAbstractCommunicationSelfTest.java | 3 +-
...pCommunicationSpiConcurrentConnectSelfTest.java | 3 +-
.../tcp/GridTcpCommunicationSpiConfigSelfTest.java | 3 +-
...idTcpCommunicationSpiMultithreadedSelfTest.java | 3 +-
...GridTcpCommunicationSpiRecoveryAckSelfTest.java | 3 +-
.../GridTcpCommunicationSpiRecoverySelfTest.java | 3 +-
...TcpCommunicationRecoveryAckClosureSelfTest.java | 3 +-
.../tcp/DiscoveryUnmarshalVulnerabilityTest.java | 26 +-
.../spi/discovery/tcp/TestTcpDiscoverySpi.java | 3 +-
.../ignite/testframework/GridSpiTestContext.java | 3 +-
.../apache/ignite/testframework/GridTestUtils.java | 15 +-
.../ignite/testframework/junits/IgniteMock.java | 2 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 -
.../ignite/testsuites/IgniteUtilSelfTestSuite.java | 2 +
.../codegen/TestCollectionsMessageMarshaller.java | 5 +-
.../codegen/TestJdkMarshalledChildMessage.java} | 22 +-
.../TestJdkMarshalledChildMessageMarshaller.java | 83 ++++++
.../codegen/TestJdkMarshalledMessage.java} | 28 +-
.../TestJdkMarshalledMessageMarshaller.java | 74 +++++
.../codegen/TestMapMessageMarshaller.java | 5 +-
.../codegen/TestMarshallableMessageMarshaller.java | 16 +-
.../TestMarshalledArrayMapMessageMarshaller.java | 21 +-
.../TestMarshalledCollectionMessageMarshaller.java | 5 +-
.../TestMarshalledMapMessageMarshaller.java | 5 +-
.../codegen/TestMarshalledMessageMarshaller.java | 16 +-
.../TestMarshalledObjectsMessageMarshaller.java | 16 +-
.../resources/codegen/TestMessageMarshaller.java | 11 +-
.../TestSelfMarshallingMessageMarshaller.java | 7 +-
.../zk/internal/DiscoveryMessageParser.java | 6 +-
134 files changed, 947 insertions(+), 638 deletions(-)
diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/direct/JmhDirectMessageReaderBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/direct/JmhDirectMessageReaderBenchmark.java
index e35091ec3ca..7c93e2be90b 100644
--- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/direct/JmhDirectMessageReaderBenchmark.java
+++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/direct/JmhDirectMessageReaderBenchmark.java
@@ -44,7 +44,6 @@ import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.openjdk.jmh.annotations.Mode.Throughput;
/** Benchmarks the {@link DirectMessageReader} compressed-field hot path. */
@@ -122,6 +121,6 @@ public class JmhDirectMessageReaderBenchmark {
/** */
private static MessageFactory msgFactory() {
return new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{
- new CoreMessagesProvider(jdk(), jdk())});
+ new CoreMessagesProvider()});
}
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/GenericValueMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/GenericValueMessage.java
index 285c926f662..645a2c46cd0 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/GenericValueMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/GenericValueMessage.java
@@ -19,11 +19,9 @@ package org.apache.ignite.internal.processors.query.calcite.message;
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;
/** */
-@UseBinaryMarshaller
public final class GenericValueMessage implements Message {
/** */
@Marshalled("serialized")
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
index 20bce3d5005..87bed7850dc 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
@@ -27,10 +27,10 @@ import org.apache.ignite.internal.DeferredUnmarshalMessage;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor;
import org.apache.ignite.internal.processors.query.calcite.exec.QueryTaskExecutor;
import org.apache.ignite.internal.processors.query.calcite.util.AbstractService;
@@ -183,7 +183,7 @@ public class MessageServiceImpl extends AbstractService implements MessageServic
private void onMessageInternal(UUID nodeId, Message msg, boolean unmarshal) {
if (unmarshal) {
try {
- MessageMarshalling.unmarshal(msg, kctx);
+ CommunicationMarshalling.unmarshal(msg, kctx);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java
index 31856081a2c..58c40688c23 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java
@@ -23,13 +23,11 @@ import java.util.UUID;
import org.apache.ignite.internal.DeferredUnmarshalMessage;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentDescription;
import org.jetbrains.annotations.Nullable;
/** Message sent to remote nodes to start a query fragment execution. */
-@UseBinaryMarshaller
public class QueryStartRequest implements DeferredUnmarshalMessage, ExecutionContextAware {
/** */
@Order(0)
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java
index 422a9d71d92..435c8e6e670 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java
@@ -34,7 +34,6 @@ import org.apache.ignite.internal.processors.query.calcite.message.CalciteMessag
import org.apache.ignite.internal.processors.query.calcite.trait.AllNodes;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
-import org.apache.ignite.marshaller.Marshallers;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.junit.Before;
import org.junit.Test;
@@ -101,8 +100,6 @@ public class ContinuousExecutionTest extends AbstractExecutionTest {
CalciteMessageFactory msgFactory = new CalciteMessageFactory();
- msgFactory.init(Marshallers.jdk(), Marshallers.jdk());
-
// Register messages in Message#REGISTRATIONS and avoids failure in Message#directType().
new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{msgFactory});
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteCommunicationMessageSerializationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteCommunicationMessageSerializationTest.java
index d703949d78c..14dcfb80148 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteCommunicationMessageSerializationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteCommunicationMessageSerializationTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.query.calcite.message;
import org.apache.ignite.internal.managers.AbstractMessageSerializationTest;
-import org.apache.ignite.marshaller.Marshallers;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
/** */
@@ -27,8 +26,6 @@ public class CalciteCommunicationMessageSerializationTest extends AbstractMessag
@Override protected MessageFactoryProvider messageFactory() {
CalciteMessageFactory msgFactory = new CalciteMessageFactory();
- msgFactory.init(Marshallers.jdk(), Marshallers.jdk());
-
return msgFactory;
}
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java
index 327f28386cd..45d63096530 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java
@@ -65,7 +65,6 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor;
import org.apache.ignite.internal.thread.pool.IgniteStripedThreadPoolExecutor;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.marshaller.Marshallers;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.junit.Assert;
@@ -85,8 +84,6 @@ public class PlanExecutionTest extends AbstractPlannerTest {
CalciteMessageFactory msgFactory = new CalciteMessageFactory();
- msgFactory.init(Marshallers.jdk(), Marshallers.jdk());
-
// Register messages in Message#REGISTRATIONS and avoids failure in Message#directType().
new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{msgFactory});
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/UseBinaryMarshaller.java b/modules/codegen/src/main/java/org/apache/ignite/internal/JdkMarshalled.java
similarity index 56%
rename from modules/core/src/main/java/org/apache/ignite/internal/UseBinaryMarshaller.java
rename to modules/codegen/src/main/java/org/apache/ignite/internal/JdkMarshalled.java
index 3228f48aa26..a04beda8394 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/UseBinaryMarshaller.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/internal/JdkMarshalled.java
@@ -14,25 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.ignite.internal;
-import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.plugin.extensions.communication.Message;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
- * In case message CAN contain user provided classes it must be marshalled with the {@link BinaryMarshaller}.
- * {@link BinaryMarshaller} is able to process user classes using schema tansfering protocol through Discovery.
- * Mark {@link Message} class with annotation to serialize it with {@link BinaryMarshaller}.
+ * Marshals the message with the JDK marshaller of the local node, whatever marshaller the transport uses. Put it on a
+ * message that travels both transports: a {@link Marshalled} field caches its wire form, and only the JDK marshaller
+ * is read by both. It also asks for no cluster-wide type registration, which a discovery thread cannot wait
+ * for: the answer comes back through discovery, which that very thread has to move forward.
+ *
+ * @see Marshalled
*/
-@Documented
-@Target(value = TYPE)
-@Retention(RUNTIME)
-public @interface UseBinaryMarshaller {
- // No-op.
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface JdkMarshalled {
}
diff --git a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageMarshallerGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageMarshallerGenerator.java
index adb45e3a50d..be26f4b3ce0 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageMarshallerGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageMarshallerGenerator.java
@@ -115,8 +115,11 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
/** Whether the message marshals fields of its own, so the generated methods call its step. */
private boolean selfMarshalling;
- /** */
- private boolean hasMarshalled;
+ /** Whether the message pins the JDK marshaller, see {@link JdkMarshalled}. */
+ private boolean jdkMarshalled;
+
+ /** Name of the marshaller the generated body uses: the transport one, or the pinned JDK one. */
+ private String marshVar;
/** Whether any generated method got a non-empty body; a marshaller without one is skipped entirely. */
private boolean hasStatements;
@@ -170,7 +173,8 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
marshallable = marshallableMsgType != null && assignableFrom(type.asType(), marshallableMsgType);
selfMarshalling = selfMarshallingMsgType != null && assignableFrom(type.asType(), selfMarshallingMsgType);
- hasMarshalled = kinds.values().stream().anyMatch(k -> k == MarshalledKind.BLOB || k == MarshalledKind.ELEMENT_BLOBS);
+ jdkMarshalled = pinsJdkMarshaller(type);
+ marshVar = jdkMarshalled ? "jdkMarsh" : "marsh";
generateMarshalMethod(fields);
generateUnmarshalMethods(fields);
@@ -185,15 +189,12 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
imports.add(type.toString());
imports.add(MESSAGE_MARSHALLER_CLS);
- if (marshallable || hasMarshalled)
- imports.add(MARSHALLER_CLS);
+ imports.add(MARSHALLER_CLS);
writeClassHeader(writer, "MessageMarshaller", marshallerClsName);
writer.write(" {" + NL);
- writeConstructor(writer, marshallerClsName);
-
for (String line : marshall)
writer.write(line + NL);
@@ -203,39 +204,14 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
}
}
- /** Writes the {@code marshaller} field and the constructor initializing it, when the marshaller is needed. */
- private void writeConstructor(Writer writer, String marshallerClsName) throws IOException {
- if (!marshallable && !hasMarshalled)
- return;
-
- writer.write(indentedLine(METHOD_JAVADOC));
- writer.write(NL);
- writer.write(indentedLine("private final Marshaller marshaller;"));
- writer.write(NL + NL);
-
- writer.write(indentedLine(METHOD_JAVADOC));
- writer.write(NL);
- writer.write(indentedLine("public " + marshallerClsName + "(Marshaller marshaller) {"));
- writer.write(NL);
-
- indent++;
-
- writer.write(indentedLine("this.marshaller = marshaller;"));
- writer.write(NL);
-
- indent--;
-
- writer.write(indentedLine("}"));
- writer.write(NL + NL);
- }
-
/** Generates the {@code marshal} method body and appends it to {@link #marshall}. */
private void generateMarshalMethod(List<VariableElement> orderedFields) {
imports.add(IGNITE_CHECKED_EXCEPTION_CLS);
imports.add(GRID_KERNAL_CONTEXT_CLS);
imports.add(CACHE_OBJECT_CONTEXT_CLS);
- String signature = "marshal(" + simpleNameWithGeneric(type) + " msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx)";
+ String signature = "marshal(" + simpleNameWithGeneric(type)
+ + " msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx)";
hasStatements |= emitMethod(marshall, signature, body -> {
usesMsgFactory = false;
@@ -250,11 +226,12 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
appendMarshalledPrepare(body);
if (marshallable)
- appendBlock(body, List.of(indentedLine("msg.marshal(marshaller);")));
+ appendBlock(body, List.of(indentedLine("msg.marshal(%s);", marshVar)));
appendFields(body, orderedFields, MarshalMode.MARSHAL);
prependMsgFactoryResolution(body);
+ prependPinnedMarshaller(body);
});
}
@@ -289,7 +266,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
if (usesU)
imports.add(U_CLS);
- String msgParam = simpleNameWithGeneric(type) + " msg, GridKernalContext kctx";
+ String msgParam = simpleNameWithGeneric(type) + " msg, Marshaller marsh, GridKernalContext kctx";
generateUnmarshalMethod(msgParam + ", CacheObjectContext cacheObjCtx, ClassLoader clsLdr", workerFields);
@@ -310,7 +287,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
appendFields(body, fields, MarshalMode.UNMARSHAL, wireFieldSkip);
if (marshallable)
- appendBlock(body, List.of(indentedLine("msg.unmarshal(marshaller, clsLdr);")));
+ appendBlock(body, List.of(indentedLine("msg.unmarshal(%s, clsLdr);", marshVar)));
appendMarshalledFinish(body);
@@ -322,6 +299,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
appendBlock(body, List.of(indentedLine("msg.selfUnmarshal();")));
prependMsgFactoryResolution(body);
+ prependPinnedMarshaller(body);
});
}
@@ -330,6 +308,8 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
hasStatements |= emitMethod(marshall, "unmarshalNio(" + params + ")", body -> {
for (VariableElement f : nioFields)
appendBlock(body, unmarshalNioField(fieldAccessor(f)));
+
+ prependPinnedMarshaller(body);
});
}
@@ -343,7 +323,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
indent++;
- code.add(indentedLine("MessageMarshalling.unmarshal(%s, kctx);", accessor));
+ code.add(indentedLine("MessageMarshalling.unmarshal(%s, %s, kctx);", accessor, marshVar));
indent--;
@@ -383,7 +363,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
indent++;
- code.add(indentedLine("%s.add(U.marshal(marshaller, e));", bytesField));
+ code.add(indentedLine("%s.add(U.marshal(%s, e));", bytesField, marshVar));
indent--;
indent--;
@@ -455,7 +435,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
indent++;
- code.add(indentedLine("%s = U.marshal(marshaller, %s);", bytesAcc, objAcc));
+ code.add(indentedLine("%s = U.marshal(%s, %s);", bytesAcc, marshVar, objAcc));
indent--;
@@ -472,7 +452,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
indent++;
- code.add(indentedLine("%s = U.unmarshal(marshaller, %s, clsLdr);", objAcc, bytesAcc));
+ code.add(indentedLine("%s = U.unmarshal(%s, %s, clsLdr);", objAcc, marshVar, bytesAcc));
code.add(EMPTY);
// Drop the serialized cache once the object is restored: keeping both the deserialized value and its bytes
@@ -546,7 +526,7 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
indent++;
- code.add(indentedLine("Object o = U.unmarshal(marshaller, e, clsLdr);"));
+ code.add(indentedLine("Object o = U.unmarshal(%s, e, clsLdr);", marshVar));
code.add(EMPTY);
code.add(indentedLine("if (o instanceof Map.Entry) {"));
@@ -862,13 +842,13 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
usesMsgFactory = true;
code.add(mode == MarshalMode.MARSHAL
- ? indentedLine("MessageMarshalling.marshal(msgFactory, %s, kctx, ctx);", accessor)
- : indentedLine("MessageMarshalling.unmarshal(msgFactory, %s, kctx, ctx, clsLdr);", accessor));
+ ? indentedLine("MessageMarshalling.marshal(msgFactory, %s, %s, kctx, ctx);", accessor, marshVar)
+ : indentedLine("MessageMarshalling.unmarshal(msgFactory, %s, %s, kctx, ctx, clsLdr);", accessor, marshVar));
}
else {
code.add(mode == MarshalMode.MARSHAL
- ? indentedLine("MessageMarshalling.marshal(%s, kctx, ctx);", accessor)
- : indentedLine("MessageMarshalling.unmarshal(%s, kctx, ctx, clsLdr);", accessor));
+ ? indentedLine("MessageMarshalling.marshal(%s, %s, kctx, ctx);", accessor, marshVar)
+ : indentedLine("MessageMarshalling.unmarshal(%s, %s, kctx, ctx, clsLdr);", accessor, marshVar));
}
indent--;
@@ -1007,6 +987,34 @@ public class MessageMarshallerGenerator extends MessageCompanionGenerator {
body.add(0, indentedLine("IgniteMessageFactory msgFactory = (IgniteMessageFactory)kctx.messageFactory();"));
}
+ /**
+ * The pin belongs to the message as a whole, so a subclass marshals the inherited fields the same way its parent
+ * does.
+ *
+ * @return {@code True} if {@code type} or any of its ancestors is annotated with {@link JdkMarshalled}.
+ */
+ private boolean pinsJdkMarshaller(TypeElement type) {
+ for (TypeElement el = type; el != null; ) {
+ if (el.getAnnotation(JdkMarshalled.class) != null)
+ return true;
+
+ Element superEl = env.getTypeUtils().asElement(el.getSuperclass());
+
+ el = superEl instanceof TypeElement ? (TypeElement)superEl : null;
+ }
+
+ return false;
+ }
+
+ /** Prefixes {@code body} with the pinned marshaller resolution line, see {@link JdkMarshalled}. */
+ private void prependPinnedMarshaller(List<String> body) {
+ if (!jdkMarshalled || body.stream().noneMatch(line -> line.contains(marshVar)))
+ return;
+
+ body.add(0, EMPTY);
+ body.add(0, indentedLine("Marshaller %s = kctx.marshallerContext().jdkMarshaller();", marshVar));
+ }
+
/** Returns empty if {@code inner} is empty; otherwise wraps {@code inner} in a null-guard on {@code nullGuard}. */
private List<String> wrapNullGuarded(String nullGuard, List<String> inner) {
if (inner.isEmpty())
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
index b92aabba879..ef05f8b47fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.cache.query.QueryIndexMessage;
import org.apache.ignite.internal.cache.query.index.IndexQueryResultMeta;
import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyDefinition;
@@ -288,8 +287,6 @@ import org.apache.ignite.internal.util.GridPartitionStateMap;
import org.apache.ignite.internal.util.distributed.FullMessage;
import org.apache.ignite.internal.util.distributed.InitMessage;
import org.apache.ignite.internal.util.distributed.SingleNodeMessage;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.security.SecurityBasicPermissionSet;
import org.apache.ignite.spi.collision.jobstealing.JobStealingRequest;
@@ -355,22 +352,11 @@ public class CoreMessagesProvider extends AbstractMessageFactoryProvider {
/**
* Default plugin-purposes constructor.
*
- * @see #init(Marshaller, Marshaller)
*/
public CoreMessagesProvider() {
// No-op.
}
- /**
- * Constructor allowing not to call {@link #init(Marshaller, Marshaller)}.
- *
- * @param dfltMarsh Schema-less marshaller like {@link JdkMarshaller}.
- * @param schemaAwareMarsh Schema-aware marshaller like {@link BinaryMarshaller}.
- */
- public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh) {
- init(dfltMarsh, schemaAwareMarsh);
- }
-
/**
* Registers all the messages into {@code factory}.
* The listing order is important here. If wish to remove a message, put 'msgIdx++' on its place. If wish to add,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
index a90c99a1d2f..88b669bfe30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
@@ -39,7 +39,6 @@ import org.jetbrains.annotations.Nullable;
* Job execution request.
*/
@SuppressWarnings({"AssignmentOrReturnOfFieldWithMutableType", "NullableProblems"})
-@UseBinaryMarshaller
public class GridJobExecuteRequest implements ExecutorAwareMessage, DeferredUnmarshalMessage {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
index 6e1c14fe240..c28baa21915 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
@@ -29,7 +29,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Job execution response.
*/
-@UseBinaryMarshaller
public class GridJobExecuteResponse implements DeferredUnmarshalMessage {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
index 1392ed8b179..57fdbac05b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
@@ -28,7 +28,6 @@ import org.apache.ignite.plugin.extensions.communication.Message;
/**
* Task session request.
*/
-@UseBinaryMarshaller
public class GridTaskSessionRequest implements Message {
/** Task session ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java
index 0f8bc1d5236..71251ddd84b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java
@@ -24,7 +24,6 @@ import org.apache.ignite.marshaller.Marshaller;
import org.jetbrains.annotations.Nullable;
/** Message wrapper for grid topic. */
-@UseBinaryMarshaller
public class GridTopicMessage implements MarshallableMessage {
/** Topic. */
private Object topic;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticRequest.java
index 9e4a915dc7b..57a240b11fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticRequest.java
@@ -31,7 +31,6 @@ import org.jetbrains.annotations.Nullable;
/**
*
*/
-@UseBinaryMarshaller
public class IgniteDiagnosticRequest implements Message {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 3d7ccc8ffa2..33539428faf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -111,7 +111,6 @@ import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
import org.apache.ignite.internal.managers.systemview.GridSystemViewManager;
import org.apache.ignite.internal.managers.systemview.IgniteConfigurationIterable;
import org.apache.ignite.internal.marshaller.ClassLoaderUtils;
-import org.apache.ignite.internal.plugin.AbstractMessageFactoryProvider;
import org.apache.ignite.internal.plugin.IgniteLogInfoProvider;
import org.apache.ignite.internal.plugin.IgniteLogInfoProviderImpl;
import org.apache.ignite.internal.processors.GridProcessor;
@@ -1312,7 +1311,7 @@ public class IgniteKernal implements IgniteEx, Externalizable {
List<MessageFactoryProvider> compMsgs = new ArrayList<>();
- compMsgs.add(new CoreMessagesProvider(ctx.marshallerContext().jdkMarshaller(), ctx.marshaller()));
+ compMsgs.add(new CoreMessagesProvider());
for (IgniteComponentType compType : IgniteComponentType.values()) {
MessageFactoryProvider f = compType.messageFactory();
@@ -1333,24 +1332,9 @@ public class IgniteKernal implements IgniteEx, Externalizable {
if (!compMsgs.isEmpty())
msgs = F.concat(msgs, compMsgs.toArray(new MessageFactoryProvider[compMsgs.size()]));
- for (MessageFactoryProvider msg : msgs)
- initProvider(msg);
-
msgFactory = new IgniteMessageFactoryImpl(msgs);
}
- /**
- * Re-init {@link AbstractMessageFactoryProvider} with a proper marshaller.
- *
- * @param factoryProvider Message factory provider.
- */
- private void initProvider(MessageFactoryProvider factoryProvider) {
- if (factoryProvider instanceof AbstractMessageFactoryProvider) {
- ((AbstractMessageFactoryProvider)factoryProvider).init(ctx.marshallerContext().jdkMarshaller(),
- ctx.marshaller());
- }
- }
-
/**
* @return Ignite security processor. See {@link IgniteSecurity} for details.
*/
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/TxEntriesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/TxEntriesInfo.java
index 074ad98ef36..d2999ac6b45 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/TxEntriesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/TxEntriesInfo.java
@@ -30,7 +30,6 @@ import org.apache.ignite.plugin.extensions.communication.CacheIdAware;
* Diagnostic info block that dumps the state of cache entries for the given keys. Requested when a transaction
* lock future waits for a remote node's response for too long.
*/
-@UseBinaryMarshaller
public final class TxEntriesInfo extends IgniteDiagnosticRequest.DiagnosticBaseInfo implements CacheIdAware {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/CommunicationMarshalling.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/CommunicationMarshalling.java
new file mode 100644
index 00000000000..7accdac5e65
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/CommunicationMarshalling.java
@@ -0,0 +1,61 @@
+/*
+ * 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 org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Marshalling of the Communication transport. It uses the schema-aware marshaller, {@link BinaryMarshaller}, which
+ * writes a type once and refers to it by id afterwards, so a type unknown to the cluster has to be registered first.
+ */
+public final class CommunicationMarshalling {
+ /** Guards against instantiation: the class is a set of static entry points, and this says so. */
+ private CommunicationMarshalling() {
+ // No-op.
+ }
+
+ /** */
+ public static <M extends Message> void marshal(M msg,
+ GridKernalContext kctx,
+ @Nullable CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ MessageMarshalling.marshal(msg, kctx.marshaller(), kctx, cacheObjCtx);
+ }
+
+ /** */
+ public static <M extends Message> void unmarshal(M msg,
+ GridKernalContext kctx,
+ @Nullable CacheObjectContext cacheObjCtx,
+ ClassLoader clsLdr) throws IgniteCheckedException {
+ MessageMarshalling.unmarshal(msg, kctx.marshaller(), kctx, cacheObjCtx, clsLdr);
+ }
+
+ /** */
+ public static <M extends Message> void unmarshal(M msg, GridKernalContext kctx) throws IgniteCheckedException {
+ MessageMarshalling.unmarshal(msg, kctx.marshaller(), kctx);
+ }
+
+ /** */
+ public static <M extends Message> void unmarshalNio(M msg, GridKernalContext kctx) throws IgniteCheckedException {
+ MessageMarshalling.unmarshalNio(msg, kctx.marshaller(), kctx);
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/DiscoveryMarshalling.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/DiscoveryMarshalling.java
new file mode 100644
index 00000000000..680c7db2c60
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/DiscoveryMarshalling.java
@@ -0,0 +1,52 @@
+/*
+ * 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 org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Marshalling of the discovery transport. It uses the JDK marshaller, which asks for no type registration at all.
+ * <p>
+ * A discovery message is marshalled by a thread that has to move discovery forward itself: the ring worker writing
+ * it to the socket, a custom event listener marshalling inline, or a node that is not in the ring yet. The binary
+ * marshaller would make such a thread wait for a cluster-wide round - a class name mapping, or a new metadata
+ * version - and only a discovery thread delivers the answer, so the wait never ends and the ring stops with it.
+ * A type the cluster has already accepted marshals fine, but a message cannot rely on that.
+ */
+public final class DiscoveryMarshalling {
+ /** Guards against instantiation: the class is a set of static entry points, and this says so. */
+ private DiscoveryMarshalling() {
+ // No-op.
+ }
+
+ /** */
+ public static <M extends Message> void marshal(M msg,
+ GridKernalContext kctx,
+ @Nullable CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ MessageMarshalling.marshal(msg, kctx.marshallerContext().jdkMarshaller(), kctx, cacheObjCtx);
+ }
+
+ /** */
+ public static <M extends Message> void unmarshal(M msg, GridKernalContext kctx) throws IgniteCheckedException {
+ MessageMarshalling.unmarshal(msg, kctx.marshallerContext().jdkMarshaller(), kctx);
+ }
+}
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 43634e9e126..7a216c65a58 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
@@ -770,12 +770,12 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Object>>
// Not a double unmarshal: the @NioField routing header is restored here on the NIO thread, its full
// payload below on a pool thread — disjoint fields.
- MessageMarshalling.unmarshalNio(initMsg, ctx);
+ CommunicationMarshalling.unmarshalNio(initMsg, ctx);
pools.poolForPolicy(plc).execute(new Runnable() {
@Override public void run() {
try {
- MessageMarshalling.unmarshal(initMsg, ctx);
+ CommunicationMarshalling.unmarshal(initMsg, ctx);
processOpenedChannel(initMsg.topic(), rmtNodeId, (SessionChannelMessage)initMsg.message(),
(SocketChannel)channel);
@@ -848,7 +848,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Object>>
// After the delayed-message gate: a replayed message re-enters this method, so its NIO-thread header
// unmarshal is kept here to run exactly once.
- MessageMarshalling.unmarshalNio(msg, ctx);
+ CommunicationMarshalling.unmarshalNio(msg, ctx);
// If message is P2P, then process in P2P service.
// This is done to avoid extra waiting and potential deadlocks
@@ -1047,7 +1047,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Object>>
return;
try {
- MessageMarshalling.unmarshal(msg.message(), ctx);
+ CommunicationMarshalling.unmarshal(msg.message(), ctx);
}
catch (IgniteCheckedException e) {
throw new IgniteException("Failed to unmarshal message payload", e);
@@ -1632,7 +1632,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Object>>
private void marshal(GridIoMessage ioMsg) throws IgniteCheckedException {
assert !ioMsg.marshalled() : "GridIoMessage is marshalled twice: " + ioMsg;
- MessageMarshalling.marshal(ioMsg, ctx, null);
+ CommunicationMarshalling.marshal(ioMsg, ctx, null);
ioMsg.markMarshalled();
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
index ef4f0b61a8b..7861538d9b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.managers.communication;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoMessage;
@@ -29,7 +28,6 @@ import org.jetbrains.annotations.Nullable;
/**
* User message wrapper.
*/
-@UseBinaryMarshaller
public class GridIoUserMessage implements Message {
/** Message body. */
private Object body;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/MessageMarshalling.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/MessageMarshalling.java
index 0e1ac93d345..6f1bb5035c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/MessageMarshalling.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/MessageMarshalling.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.managers.communication;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
* message's direct type in {@code kctx.messageFactory()} and delegates to it, or skips when none is registered.
*/
public final class MessageMarshalling {
- /** */
+ /** Guards against instantiation: the class is a set of static entry points, and this says so. */
private MessageMarshalling() {
// No-op.
}
@@ -38,12 +39,13 @@ public final class MessageMarshalling {
* Marshals {@code msg} through its registered marshaller; a no-op when none is registered.
*
* @param msg Message to marshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
* @param cacheObjCtx Cache object context of the enclosing message, or {@code null} at the top level.
*/
- public static <M extends Message> void marshal(M msg, GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx)
- throws IgniteCheckedException {
- marshal(factory(kctx), msg, kctx, cacheObjCtx);
+ public static <M extends Message> void marshal(M msg, Marshaller marsh, GridKernalContext kctx,
+ @Nullable CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ marshal(factory(kctx), msg, marsh, kctx, cacheObjCtx);
}
/**
@@ -52,28 +54,30 @@ public final class MessageMarshalling {
*
* @param msgFactory Message factory to resolve the marshaller from.
* @param msg Message to marshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
* @param cacheObjCtx Cache object context of the enclosing message, or {@code null} at the top level.
*/
- public static <M extends Message> void marshal(IgniteMessageFactory msgFactory, M msg, GridKernalContext kctx,
- @Nullable CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ public static <M extends Message> void marshal(IgniteMessageFactory msgFactory, M msg, Marshaller marsh,
+ GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
MessageMarshaller<M> m = resolve(msgFactory, msg);
if (m != null)
- m.marshal(msg, kctx, cacheObjCtx);
+ m.marshal(msg, marsh, kctx, cacheObjCtx);
}
/**
* Unmarshals {@code msg} through its registered marshaller with full cache context; a no-op when none is registered.
*
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
* @param cacheObjCtx Cache object context of the enclosing message, or {@code null} at the top level.
* @param clsLdr Class loader for unmarshalling.
*/
- public static <M extends Message> void unmarshal(M msg, GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx,
- ClassLoader clsLdr) throws IgniteCheckedException {
- unmarshal(factory(kctx), msg, kctx, cacheObjCtx, clsLdr);
+ public static <M extends Message> void unmarshal(M msg, Marshaller marsh, GridKernalContext kctx,
+ @Nullable CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ unmarshal(factory(kctx), msg, marsh, kctx, cacheObjCtx, clsLdr);
}
/**
@@ -82,35 +86,39 @@ public final class MessageMarshalling {
*
* @param msgFactory Message factory to resolve the marshaller from.
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
* @param cacheObjCtx Cache object context of the enclosing message, or {@code null} at the top level.
* @param clsLdr Class loader for unmarshalling.
*/
- public static <M extends Message> void unmarshal(IgniteMessageFactory msgFactory, M msg, GridKernalContext kctx,
- @Nullable CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ public static <M extends Message> void unmarshal(IgniteMessageFactory msgFactory, M msg, Marshaller marsh,
+ GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx, ClassLoader clsLdr)
+ throws IgniteCheckedException {
assert !MessageUnmarshalOnceCheck.ENABLED || MessageUnmarshalOnceCheck.firstUnmarshal(msg, true)
: "Finish-unmarshalled more than once: " + msg.getClass().getName();
MessageMarshaller<M> m = resolve(msgFactory, msg);
if (m != null)
- m.unmarshal(msg, kctx, cacheObjCtx, clsLdr);
+ m.unmarshal(msg, marsh, kctx, cacheObjCtx, clsLdr);
}
/**
* Cache-free {@code unmarshal} through the registered marshaller; a no-op when none is registered.
*
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
*/
- public static <M extends Message> void unmarshal(M msg, GridKernalContext kctx) throws IgniteCheckedException {
+ public static <M extends Message> void unmarshal(M msg, Marshaller marsh, GridKernalContext kctx)
+ throws IgniteCheckedException {
assert !MessageUnmarshalOnceCheck.ENABLED || MessageUnmarshalOnceCheck.firstUnmarshal(msg, false)
: "Finish-unmarshalled more than once: " + msg.getClass().getName();
MessageMarshaller<M> m = resolve(factory(kctx), msg);
if (m != null)
- m.unmarshal(msg, kctx);
+ m.unmarshal(msg, marsh, kctx);
}
/**
@@ -118,13 +126,15 @@ public final class MessageMarshalling {
* is registered.
*
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
*/
- public static <M extends Message> void unmarshalNio(M msg, GridKernalContext kctx) throws IgniteCheckedException {
+ public static <M extends Message> void unmarshalNio(M msg, Marshaller marsh, GridKernalContext kctx)
+ throws IgniteCheckedException {
MessageMarshaller<M> m = resolve(factory(kctx), msg);
if (m != null)
- m.unmarshalNio(msg, kctx);
+ m.unmarshalNio(msg, marsh, kctx);
}
/** @return the message factory of {@code kctx}. */
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
index e1d033df696..da409dc0d58 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
@@ -18,11 +18,9 @@
package org.apache.ignite.internal.managers.eventstorage;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
/** */
-@UseBinaryMarshaller
public class EventsDataBagItem implements Message {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
index 62ee043907a..80471e56d24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
@@ -48,9 +48,9 @@ import org.apache.ignite.internal.IgniteDeploymentCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.GridManagerAdapter;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.processors.platform.PlatformEventFilterListener;
@@ -1242,7 +1242,7 @@ public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi>
Collection<Event> evts;
try {
- MessageMarshalling.unmarshal(req, ctx, null,
+ CommunicationMarshalling.unmarshal(req, ctx, null,
ctx.deploy().classLoader(req.deploymentInfo(), req.filterClassName(), nodeId));
filter = (IgnitePredicate<Event>)req.filter();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageRequest.java
index 322d8bc2bc1..52154ccca27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.managers.eventstorage;
import org.apache.ignite.internal.DeferredUnmarshalMessage;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoMessage;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -30,7 +29,6 @@ import org.apache.ignite.lang.IgniteUuid;
import static org.apache.ignite.internal.GridTopic.TOPIC_EVENT;
/** Remote event query. The filter is a user class, hence the deferred unmarshalling. */
-@UseBinaryMarshaller
public class GridEventStorageRequest implements DeferredUnmarshalMessage {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageResponse.java
index 19136bcc96a..c7c21432575 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageResponse.java
@@ -22,14 +22,12 @@ import java.util.Collections;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.util.ErrorMessage;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.jetbrains.annotations.Nullable;
/** Events collected for a {@link GridEventStorageRequest}, or the failure that prevented it. */
-@UseBinaryMarshaller
public class GridEventStorageResponse implements Message {
/** */
@Marshalled("evtsBytes")
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/plugin/AbstractMessageFactoryProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/plugin/AbstractMessageFactoryProvider.java
index 44b21069ae0..ca7c9b37ed5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/plugin/AbstractMessageFactoryProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/plugin/AbstractMessageFactoryProvider.java
@@ -21,13 +21,9 @@ import java.lang.reflect.Constructor;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.SelfMarshallingMessage;
-import org.apache.ignite.internal.UseBinaryMarshaller;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.managers.communication.IgniteMessageFactory;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.GridCacheMessageDeployer;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
@@ -36,8 +32,7 @@ import org.apache.ignite.plugin.extensions.communication.NonMarshallableMessage;
import org.jetbrains.annotations.Nullable;
/**
- * An extension of {@link MessageFactoryProvider} allowing to use provided schema-aware marshaller
- * to register {@link MarshallableMessage}.
+ * An extension of {@link MessageFactoryProvider} that wires a message to its generated companions.
*/
public abstract class AbstractMessageFactoryProvider implements MessageFactoryProvider {
/** Generated-companion constructors per message class, including cached negative lookups. */
@@ -47,33 +42,9 @@ public abstract class AbstractMessageFactoryProvider implements MessageFactoryPr
}
};
- /** Default schema-less marshaller. */
- protected Marshaller dfltMarsh;
-
- /** Schema-aware marshaller like {@link BinaryMarshaller}. */
- protected Marshaller schemaAwareMarsh;
-
- /**
- * @param dfltMarsh Default schema-less marshaller like {@link JdkMarshaller}.
- * @param schemaAwareMarsh Schema-aware marshaller like {@link BinaryMarshaller}.
- */
- public void init(Marshaller dfltMarsh, Marshaller schemaAwareMarsh) {
- this.dfltMarsh = dfltMarsh;
- this.schemaAwareMarsh = schemaAwareMarsh;
- }
-
/** Register a message with a caller-provided {@code id}. */
protected <T extends Message> void register(IgniteMessageFactory factory, Class<T> cls, short id) {
- register(factory, cls, id, cls.getAnnotation(UseBinaryMarshaller.class) != null ? schemaAwareMarsh : dfltMarsh);
- }
-
- /** */
- private static <T extends Message> void register(IgniteMessageFactory factory, Class<T> cls, short id, Marshaller marsh) {
- // Companions are instantiated right here, so a provider registering before init() would bind them to a null
- // marshaller instead of picking the proper one up later.
- assert marsh != null : "Provider is not initialized, see init(), while registering " + cls.getName();
-
- MessageSerializer<T> serializer = loadGenerated(cls, "Serializer", null, true);
+ MessageSerializer<T> serializer = loadGenerated(cls, "Serializer", true);
// A message that marshals a part of its fields itself always gets a generated marshaller (its own call alone
// is a statement), so its absence is a build problem. For the rest the generator skips statement-free
@@ -87,28 +58,27 @@ public abstract class AbstractMessageFactoryProvider implements MessageFactoryPr
boolean required = MarshallableMessage.class.isAssignableFrom(cls)
|| SelfMarshallingMessage.class.isAssignableFrom(cls);
- marshaller = loadGenerated(cls, "Marshaller", marsh, required);
+ marshaller = loadGenerated(cls, "Marshaller", required);
}
// Deployers are generated for GridCacheMessage subclasses only, so the class lookup is skipped for the rest;
// a DeployableMessage left without a deployer is then rejected at registration.
GridCacheMessageDeployer<?> deployer = GridCacheMessage.class.isAssignableFrom(cls)
- ? loadGenerated(cls, "Deployer", null, false)
+ ? loadGenerated(cls, "Deployer", false)
: null;
factory.register(id, serializer, marshaller, deployer);
}
/**
- * Instantiates the generated companion class {@code <message>Serializer/Marshaller/Deployer}. Only the marshaller
- * companion ever takes a {@code Marshaller}, and only when the message has fields to marshal with one, so
- * {@code marsh} is {@code null} for the other two. Constructor lookups, including missing companions, are cached
- * per message class in {@link #COMPANIONS}.
+ * Instantiates the generated companion class {@code <message>Serializer/Marshaller/Deployer}. Companions are
+ * stateless: the marshaller, when one is needed, is passed per call by the transport. Constructor lookups,
+ * including missing companions, are cached per message class in {@link #COMPANIONS}.
*
* @return the companion, or {@code null} when it is not generated and {@code required} is {@code false}.
*/
@SuppressWarnings("unchecked")
- private static <T> @Nullable T loadGenerated(Class<?> cls, String suffix, @Nullable Marshaller marsh, boolean required) {
+ private static <T> @Nullable T loadGenerated(Class<?> cls, String suffix, boolean required) {
Constructor<?> ctor = COMPANIONS.get(cls).ctor(suffix);
if (ctor == null) {
@@ -121,11 +91,8 @@ public abstract class AbstractMessageFactoryProvider implements MessageFactoryPr
return null;
}
- assert ctor.getParameterCount() == 0 || marsh != null :
- cls.getSimpleName() + suffix + " takes a marshaller, but none was provided";
-
try {
- return (T)(ctor.getParameterCount() == 0 ? ctor.newInstance() : ctor.newInstance(marsh));
+ return (T)ctor.newInstance();
}
catch (Exception e) {
throw new IgniteException("Failed to instantiate " + cls.getSimpleName() + suffix, e);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
index 211aaf800a8..d41a3da341e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
@@ -20,13 +20,11 @@ package org.apache.ignite.internal.processors.cache;
import java.util.Objects;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.jetbrains.annotations.Nullable;
/** A unified container for common, typical cache entry predicates. */
-@UseBinaryMarshaller
public class CacheEntryPredicateAdapter implements CacheEntryPredicate {
/** */
private static final long serialVersionUID = 4647110502545358709L;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
index d5a1a1b8b3f..9425dadae58 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.plugin.extensions.communication.Message;
@@ -26,7 +25,6 @@ import org.apache.ignite.plugin.extensions.communication.Message;
/**
*
*/
-@UseBinaryMarshaller
public class CacheEvictionEntry implements Message {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
index 180e76bab63..b638cd624bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.util.ErrorMessage;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -30,7 +29,6 @@ import org.jetbrains.annotations.Nullable;
/**
*
*/
-@UseBinaryMarshaller
public class CacheInvokeDirectResult implements Message {
/** Cache key. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 225c143b8db..6998d1a3f4c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -39,10 +39,10 @@ import org.apache.ignite.failure.FailureType;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoManager.SendRetryPolicy;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.CacheGetFuture;
@@ -1539,7 +1539,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
log.debug("Set P2P context [senderId=" + nodeId + ", msg=" + cacheMsg + ']');
}
- MessageMarshalling.unmarshal(cacheMsg, cctx.kernalContext(), null, cctx.deploy().globalLoader());
+ CommunicationMarshalling.unmarshal(cacheMsg, cctx.kernalContext(), null, cctx.deploy().globalLoader());
}
catch (IgniteCheckedException e) {
cacheMsg.onClassError(e);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index d6cde719e83..20203b5d8bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -26,7 +26,6 @@ import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.UnregisteredBinaryTypeException;
import org.apache.ignite.internal.UnregisteredClassException;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -38,7 +37,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Return value for cases where both, value and success flag need to be returned.
*/
-@UseBinaryMarshaller
public class GridCacheReturn implements Message, CacheIdAware {
/** Value. */
@GridToStringInclude(sensitive = true)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
index 415bd5f890f..462f4bc0c6e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
@@ -22,6 +22,7 @@ import java.util.Collection;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cdc.CdcCacheEvent;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.JdkMarshalled;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.managers.encryption.GroupKeyEncrypted;
@@ -42,7 +43,10 @@ import org.apache.ignite.plugin.extensions.communication.MessageFactory;
* in order to be serialization wise agnostic to further additions or removals of fields.
* <p>
* All changes must be made with the respect of RU rules.
+ * <p>
+ * Travels both transports: Discovery when a cache starts, Communication when a snapshot is restored.
*/
+@JdkMarshalled
public class StoredCacheData implements Serializable, CdcCacheEvent, Message {
/** */
private static final long serialVersionUID = 0L;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataVersionInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataVersionInfo.java
index d9333b3ee30..002b77e864d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataVersionInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataVersionInfo.java
@@ -17,9 +17,9 @@
package org.apache.ignite.internal.processors.cache.binary;
import java.io.Serializable;
+import org.apache.ignite.internal.JdkMarshalled;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.plugin.extensions.communication.Message;
@@ -28,8 +28,10 @@ import org.apache.ignite.plugin.extensions.communication.Message;
* Used internally to track version counters (see javadoc for {@link MetadataUpdateProposedMessage} for more details).
* The version refers solely to the internal protocol for updating BinaryMetadata and is unknown externally.
* It can be updated dynamically from different nodes and threads on the same node.
+ * <p>
+ * Travels both transports: Discovery in the data bag, Communication in the {@link MetadataResponseMessage}.
*/
-@UseBinaryMarshaller
+@JdkMarshalled
public final class BinaryMetadataVersionInfo implements Serializable, Message {
/** */
private static final long serialVersionUID = 0L;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
index ce8cae2187d..306b2f6d901 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -32,7 +31,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
*
*/
-@UseBinaryMarshaller
public class GridCacheTtlUpdateRequest extends GridCacheIdMessage {
/** Entries keys. */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
index 57feac70717..a9055021926 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
@@ -22,7 +22,6 @@ import java.util.List;
import java.util.UUID;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -35,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Lock request message.
*/
-@UseBinaryMarshaller
public class GridDistributedLockRequest extends GridDistributedBaseMessage {
/** Skip store flag bit mask. */
private static final int SKIP_STORE_FLAG_MASK = 0x01;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index bbd37922a00..500e2d0b1c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -36,7 +35,6 @@ import org.jetbrains.annotations.Nullable;
* Lock response message.
*/
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
-@UseBinaryMarshaller
public class GridDistributedLockResponse extends GridDistributedBaseMessage {
/** Future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 7820e58513e..07f21318f97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
@@ -43,7 +42,6 @@ import org.jetbrains.annotations.Nullable;
* Transaction prepare request for optimistic and eventually consistent
* transactions.
*/
-@UseBinaryMarshaller
public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage implements IgniteTxStateAware {
/** */
private static final int NEED_RETURN_VALUE_FLAG_MASK = 0x01;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridNearUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridNearUnlockRequest.java
index 9770bf9fe3c..75e844c7227 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridNearUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridNearUnlockRequest.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -30,7 +29,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Lock request message.
*/
-@UseBinaryMarshaller
public class GridNearUnlockRequest extends GridDistributedBaseMessage {
/** Keys. */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
index 641af413b01..3d20269b8d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.BitSet;
import java.util.UUID;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest;
@@ -34,7 +33,6 @@ import org.jetbrains.annotations.Nullable;
/**
* DHT lock request.
*/
-@UseBinaryMarshaller
public class GridDhtLockRequest extends GridDistributedLockRequest {
/** Invalidate reader flags. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
index d3f2bde4dc4..cf0b9b06801 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
@@ -23,7 +23,6 @@ import java.util.HashSet;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
@@ -38,7 +37,6 @@ import org.apache.ignite.lang.IgniteUuid;
* DHT cache lock response.
*/
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
-@UseBinaryMarshaller
public class GridDhtLockResponse extends GridDistributedLockResponse implements DeployableMessage {
/** Mini future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
index 00201e3be49..43352b199ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheReturn;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishResponse;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -30,7 +29,6 @@ import org.jetbrains.annotations.Nullable;
/**
* DHT transaction finish response.
*/
-@UseBinaryMarshaller
public final class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
/** Mini future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
index 76848da191c..5715835aa01 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
@@ -25,7 +25,6 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -44,7 +43,6 @@ import org.jetbrains.annotations.Nullable;
/**
* DHT prepare request.
*/
-@UseBinaryMarshaller
public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest implements DeployableMessage {
/** Max order. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index b2adf1bdd24..f4ad3faa6bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
@@ -35,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
/**
* DHT transaction prepare response.
*/
-@UseBinaryMarshaller
public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse {
/** Evicted readers. */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
index 3a489132343..609e319171a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.GridNearUnlockRequest;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -29,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* DHT cache unlock request.
*/
-@UseBinaryMarshaller
public class GridDhtUnlockRequest extends GridNearUnlockRequest {
/** Near keys. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/TransactionAttributesAwareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/TransactionAttributesAwareRequest.java
index c1a23f39ee1..e24d5c0d418 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/TransactionAttributesAwareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/TransactionAttributesAwareRequest.java
@@ -19,12 +19,10 @@ package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.Map;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest;
/** Wraps transaction prepare request with application attributes. */
-@UseBinaryMarshaller
public class TransactionAttributesAwareRequest extends GridCacheMessage {
/** Original transaction prepare message. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/AtomicApplicationAttributesAwareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/AtomicApplicationAttributesAwareRequest.java
index 3f7aa4f7ed4..49bdc531a30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/AtomicApplicationAttributesAwareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/AtomicApplicationAttributesAwareRequest.java
@@ -19,11 +19,9 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.Map;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
/** Wraps atomic updates with application attributes. */
-@UseBinaryMarshaller
public class AtomicApplicationAttributesAwareRequest extends GridCacheIdMessage {
/** Original update message. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 40af94b3f72..49c351899d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.UUID;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheOperation;
@@ -36,7 +35,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
/**
*
*/
-@UseBinaryMarshaller
public class GridDhtAtomicSingleUpdateRequest extends GridDhtAtomicAbstractUpdateRequest {
/** Key to update. */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 3190bf92459..38c97a71990 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -22,7 +22,6 @@ import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -33,7 +32,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* DHT atomic cache backup update response.
*/
-@UseBinaryMarshaller
public class GridDhtAtomicUpdateResponse extends GridCacheIdMessage implements GridCacheDeployable {
/** Message index. */
public static final int CACHE_MSG_IDX = nextIndexId();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index ffe021fbe85..7126b9d11bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -28,7 +28,6 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -56,7 +55,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
/**
* Lite DHT cache update request sent from near node to primary node.
*/
-@UseBinaryMarshaller
public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdateRequest implements MarshallableMessage, DeployableMessage {
/** Keys to update. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
index e8586321f07..d5bdab4971d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -21,7 +21,6 @@ import java.util.Arrays;
import java.util.UUID;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
import org.apache.ignite.internal.processors.cache.GridCacheOperation;
@@ -32,7 +31,6 @@ import org.jetbrains.annotations.Nullable;
/**
*
*/
-@UseBinaryMarshaller
public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingleUpdateRequest {
/** Filter. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
index 5d3dc581b28..a346a140c0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -26,7 +26,6 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
@@ -46,7 +45,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
/**
*
*/
-@UseBinaryMarshaller
public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingleUpdateRequest
implements MarshallableMessage, DeployableMessage {
/** Optional arguments for entry processor. */
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index c064d24c0c7..ab5c61b1156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -24,7 +24,6 @@ import javax.cache.expiry.ExpiryPolicy;
import javax.cache.processor.EntryProcessor;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -44,7 +43,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
/**
*
*/
-@UseBinaryMarshaller
public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractUpdateRequest {
/** Key to update. */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 942ea04f154..3d9ab417c80 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -23,7 +23,6 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
@@ -41,7 +40,6 @@ import org.jetbrains.annotations.Nullable;
/**
* DHT atomic cache near update response.
*/
-@UseBinaryMarshaller
public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements GridCacheDeployable, DeployableMessage {
/** Cache message index. */
public static final int CACHE_MSG_IDX = nextIndexId();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
index 380a1c80e62..2c04599558b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.GridLongList;
@@ -32,7 +31,6 @@ import org.jetbrains.annotations.Nullable;
/**
*
*/
-@UseBinaryMarshaller
public class NearCacheUpdates implements Message {
/** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
index ff860952808..32a8e2bf51b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.util.ErrorMessage;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -33,7 +32,6 @@ import org.apache.ignite.plugin.extensions.communication.Message;
*
*/
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
-@UseBinaryMarshaller
public class UpdateErrors implements Message {
/** Failed keys. */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
index c151c491c08..36e74d86c20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
import java.util.Collection;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
@@ -33,7 +32,6 @@ import org.apache.ignite.lang.IgniteUuid;
* Force keys request. This message is sent by node while preloading to force another node to put given keys into the
* next batch of transmitting entries.
*/
-@UseBinaryMarshaller
public class GridDhtForceKeysRequest extends GridCacheIdMessage implements GridCacheDeployable {
/** Future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
index 340b4615f9c..2b7a0a1446a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
@@ -37,7 +36,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Force keys response. Contains absent keys.
*/
-@UseBinaryMarshaller
public class GridDhtForceKeysResponse extends GridCacheIdMessage implements GridCacheDeployable {
/** Future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
index dd38a0aee91..0cc29d226a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
@@ -41,7 +40,6 @@ import org.jetbrains.annotations.Nullable;
* Partition supply message.
*/
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
-@UseBinaryMarshaller
public class GridDhtPartitionSupplyMessage extends GridCacheGroupIdMessage implements GridCacheDeployable {
/** An unique (per demander) rebalance id. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 059ae004645..fe254d14b72 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -65,8 +65,8 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteNeedReconnectException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.pagemem.wal.record.ExchangeRecord;
@@ -3821,7 +3821,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
// Marshal eagerly: the heavy partition-map copy lands in the "Full message preparing" stage, and the
// message cached in FinishState is sent to late joiners as is (the send-path marshal-once turns no-op).
- MessageMarshalling.marshal(msg, cctx.kernalContext(), null);
+ CommunicationMarshalling.marshal(msg, cctx.kernalContext(), null);
timeBag.finishGlobalStage("Full message preparing");
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 5d20cd53dea..9be38c06198 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.Map;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
@@ -38,7 +37,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Get request. Responsible for obtaining entry from primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
-@UseBinaryMarshaller
public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheDeployable, GridCacheVersionable {
/** */
private static final int READ_THROUGH_FLAG_MASK = 0x01;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
index e159be75f3c..245a9938fe5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
@@ -38,7 +37,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Get response.
*/
-@UseBinaryMarshaller
public class GridNearGetResponse extends GridCacheIdMessage implements GridCacheDeployable, GridCacheVersionable {
/** Future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
index f79fd3cb748..13813a24412 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.near;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
@@ -30,7 +29,6 @@ import org.jetbrains.annotations.Nullable;
/**
*
*/
-@UseBinaryMarshaller
public class GridNearSingleGetRequest extends GridCacheIdMessage implements GridCacheDeployable {
/** */
private static final int READ_THROUGH_FLAG_MASK = 0x01;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
index 8a6f211b77c..30774c10369 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
@@ -35,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
/**
*
*/
-@UseBinaryMarshaller
public class GridNearSingleGetResponse extends GridCacheIdMessage implements GridCacheDeployable, DeployableMessage {
/** */
public static final int INVALID_PART_FLAG_MASK = 0x1;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index bd26d752f67..2f2043d19dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheReturn;
@@ -36,7 +35,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Near cache prepare response.
*/
-@UseBinaryMarshaller
public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse {
/** Versions that are less than lock version ({@link #version()}). */
@GridToStringInclude
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index 15f4e3b5411..222a9f9d2e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -46,7 +45,6 @@ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy
/**
* Query request.
*/
-@UseBinaryMarshaller
public class GridCacheQueryRequest extends GridCacheIdMessage implements GridCacheDeployable, DeployableMessage {
/** */
private static final int FLAG_DATA_PAGE_SCAN_DFLT = 0b00;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index b16f76dc1bc..fcb51ddb78c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -22,7 +22,6 @@ import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.cache.query.index.IndexQueryResultMeta;
import org.apache.ignite.internal.processors.cache.DeployableMessage;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -37,7 +36,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Page of cache query response.
*/
-@UseBinaryMarshaller
public class GridCacheQueryResponse extends GridCacheIdMessage implements GridCacheDeployable, DeployableMessage {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
index 841230e73f8..50e07bf1097 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.query.continuous;
import javax.cache.event.EventType;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -35,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
/**
* Continuous query entry.
*/
-@UseBinaryMarshaller
public class CacheContinuousQueryEntry implements GridCacheDeployable, Message, CacheIdAware {
/** */
private static final byte BACKUP_ENTRY = 0b0001;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index ac541a10a41..fca3a2b0037 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -51,8 +51,8 @@ import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.managers.deployment.P2PClassLoadingIssues;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -1091,7 +1091,7 @@ public final class CacheContinuousQueryHandler<K, V> implements GridContinuousHa
}
}
- MessageMarshalling.unmarshal(e, ctx, cctx.cacheObjectContext(), ldr);
+ CommunicationMarshalling.unmarshal(e, ctx, cctx.cacheObjectContext(), ldr);
Collection<CacheEntryEvent<? extends K, ? extends V>> evts = handleEvent(ctx, e);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 635524f1e09..a2d36d76d8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -28,7 +28,6 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
import org.apache.ignite.internal.processors.cache.CacheInvalidStateException;
@@ -62,7 +61,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
* {@link #equals(Object)} method, as transaction entries should use referential
* equality.
*/
-@UseBinaryMarshaller
public class IgniteTxEntry implements GridPeerDeployAware, MarshallableMessage, CacheIdAware {
/** */
private static final long serialVersionUID = 0L;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
index 2fa78225904..b428069ae48 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.transactions;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -29,7 +28,6 @@ import org.apache.ignite.plugin.extensions.communication.Message;
* Cache transaction key. This wrapper is needed because same keys may be enlisted in the same transaction
* for multiple caches.
*/
-@UseBinaryMarshaller
public class IgniteTxKey implements Message, CacheIdAware {
/** Key. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index c06d0c4bde3..4ace36ac49d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -52,9 +52,9 @@ import org.apache.ignite.failure.FailureType;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.cluster.DistributedTransactionConfiguration;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener;
import org.apache.ignite.internal.managers.eventstorage.HighPriorityListener;
@@ -3507,7 +3507,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
return;
try {
- MessageMarshalling.unmarshal(cacheMsg, cctx.kernalContext(), null, cctx.deploy().globalLoader());
+ CommunicationMarshalling.unmarshal(cacheMsg, cctx.kernalContext(), null, cctx.deploy().globalLoader());
}
catch (IgniteCheckedException e) {
cacheMsg.onClassError(e);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index 0531bc4d8f8..425e4d88cdf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.transactions;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheOperation;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -36,7 +35,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
/**
* Auxiliary class to hold value, value-has-been-set flag, value update operation, value bytes.
*/
-@UseBinaryMarshaller
public class TxEntryValueHolder implements Message {
/** Stored value. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
index fd8b6c0fa01..7785c3284d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.transactions;
import java.util.Collection;
import java.util.Set;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.A;
@@ -29,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Transactions lock list request.
*/
-@UseBinaryMarshaller
public class TxLocksRequest extends GridCacheMessage {
/** Future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
index 3ef53c28a6e..613a6898394 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -34,7 +33,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Transactions lock list response.
*/
-@UseBinaryMarshaller
public class TxLocksResponse extends GridCacheMessage {
/** Future ID. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/PartitionHashRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/PartitionHashRecord.java
index 49b93875408..241325c7ded 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/PartitionHashRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/PartitionHashRecord.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.verify;
import java.io.Serializable;
import java.util.Objects;
import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.internal.JdkMarshalled;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
@@ -33,7 +34,11 @@ import org.jetbrains.annotations.Nullable;
/**
* Record containing partition checksum, primary flag and consistent ID of owner.
+ * <p>
+ * Travels both transports, Communication and Discovery, inside the result of a snapshot check, and carries a user
+ * consistent id.
*/
+@JdkMarshalled
public class PartitionHashRecord implements Message, Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -58,7 +63,7 @@ public class PartitionHashRecord implements Message, Serializable {
/** Bytes of {@link #consistentId}. */
@Order(2)
@GridToStringExclude
- byte[] consistentIdBytes;
+ transient byte[] consistentIdBytes;
/** Partition entries content hash. */
@Order(3)
@@ -78,7 +83,7 @@ public class PartitionHashRecord implements Message, Serializable {
/** Bytes of {@link #updateCntr}. */
@Order(5)
@GridToStringExclude
- byte[] updateCntrBytes;
+ transient byte[] updateCntrBytes;
/** Size. */
@Order(6)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/TransactionsHashRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/TransactionsHashRecord.java
index 1aa7a72c2e1..1463087b1e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/TransactionsHashRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/TransactionsHashRecord.java
@@ -18,13 +18,20 @@
package org.apache.ignite.internal.processors.cache.verify;
import java.io.Serializable;
+import org.apache.ignite.internal.JdkMarshalled;
import org.apache.ignite.internal.Marshalled;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.Message;
-/** Represents committed transactions hash for a pair of nodes. */
+/**
+ * Represents committed transactions hash for a pair of nodes.
+ * <p>
+ * Travels both transports, Communication and Discovery, inside the result of a snapshot check, and carries a user
+ * consistent id.
+ */
+@JdkMarshalled
public class TransactionsHashRecord implements Message, Serializable {
/** */
private static final long serialVersionUID = 0L;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
index 42fa9112a2f..05af56e5063 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
@@ -26,9 +26,9 @@ import org.apache.ignite.internal.IgniteDeploymentCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -230,7 +230,7 @@ public class DataStreamProcessor extends GridProcessorAdapter {
StreamReceiver<?, ?> updater;
try {
- MessageMarshalling.unmarshal(req, ctx, null, U.resolveClassLoader(clsLdr, ctx.config()));
+ CommunicationMarshalling.unmarshal(req, ctx, null, U.resolveClassLoader(clsLdr, ctx.config()));
updater = req.updater();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
index a9497cd1884..17353206c0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.datastreamer;
import java.util.Map;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -30,7 +29,6 @@ import org.apache.ignite.plugin.extensions.communication.Message;
/**
*
*/
-@UseBinaryMarshaller
public class DataStreamerEntry implements Map.Entry<KeyCacheObject, CacheObject>, Message {
/** */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java
index 6eafdb8b5b0..41b90e80101 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java
@@ -19,13 +19,11 @@ 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. */
@Marshalled("rcvrBytes")
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
index e0975f49b13..0276827b6cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
@@ -66,9 +66,9 @@ import org.apache.ignite.internal.PlatformSecurityAwareJob;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.collision.GridCollisionJobContextAdapter;
import org.apache.ignite.internal.managers.collision.GridCollisionManager;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
@@ -1256,7 +1256,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
try {
// The job payload waits for this point: only now is there a deployment to unmarshal it with.
if (!loc) {
- MessageMarshalling.unmarshal(req, ctx, null,
+ CommunicationMarshalling.unmarshal(req, ctx, null,
U.resolveClassLoader(dep.classLoader(), ctx.config()));
}
@@ -1621,7 +1621,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
if (!loc) {
try {
- MessageMarshalling.marshal(jobRes, ctx, null);
+ CommunicationMarshalling.marshal(jobRes, ctx, null);
}
catch (IgniteCheckedException e) {
// The exception is the only payload of this response, so it is what could not be written.
@@ -1632,7 +1632,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
jobRes = jobRes.withError(new IgniteException(errMsg));
- MessageMarshalling.marshal(jobRes, ctx, null);
+ CommunicationMarshalling.marshal(jobRes, ctx, null);
}
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
index 167874ceff5..5c58d42811e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
@@ -46,7 +46,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable;
@@ -884,7 +884,7 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
if (!loc) {
try {
- MessageMarshalling.marshal(jobRes, ctx, null);
+ CommunicationMarshalling.marshal(jobRes, ctx, null);
}
catch (IgniteCheckedException e) {
String ids = "[nodeId=" + sndNode.id() + ", ses=" + ses.getId() +
@@ -898,7 +898,7 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
: U.convertException(e));
try {
- MessageMarshalling.marshal(jobRes, ctx, null);
+ CommunicationMarshalling.marshal(jobRes, ctx, null);
}
catch (IgniteCheckedException e0) {
// Then the exception itself is what could not be written.
@@ -908,7 +908,7 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
jobRes = jobRes.withError(new IgniteException(errMsg));
- MessageMarshalling.marshal(jobRes, ctx, null);
+ CommunicationMarshalling.marshal(jobRes, ctx, null);
}
}
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
index 3cc04906fdb..32b6ef00ba5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
@@ -19,14 +19,12 @@ package org.apache.ignite.internal.processors.rest.handlers.task;
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.jetbrains.annotations.Nullable;
/**
* Task result response.
*/
-@UseBinaryMarshaller
public class GridTaskResultResponse implements Message {
/** Result. */
@Marshalled("resBytes")
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResult.java
index 65635a3dfcc..53ac3c159dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResult.java
@@ -21,7 +21,6 @@ import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.internal.util.ErrorMessage;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -33,7 +32,6 @@ import org.jetbrains.annotations.Nullable;
* <p/>
* Contains count of deployed service instances on single node and deployment errors if exist.
*/
-@UseBinaryMarshaller
public class ServiceSingleNodeDeploymentResult implements Message, Serializable {
/** */
private static final long serialVersionUID = 0L;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index 32df3c6ca5f..12f5dfd8d10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -68,7 +68,7 @@ import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException;
import org.apache.ignite.internal.compute.ComputeTaskTimeoutCheckedException;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.closure.AffinityTask;
@@ -824,7 +824,7 @@ public class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObjec
boolean loc = ctx.localNodeId().equals(res.nodeId()) && !ctx.config().isMarshalLocalJobs();
if (!loc)
- MessageMarshalling.unmarshal(res, ctx, null, U.resolveClassLoader(dep.classLoader(), ctx.config()));
+ CommunicationMarshalling.unmarshal(res, ctx, null, U.resolveClassLoader(dep.classLoader(), ctx.config()));
jobRes.onResponse(res.getJobResult(), res.exception(), res.getJobAttributes(), res.cancelled());
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ErrorMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ErrorMessage.java
index 876b713c1a3..e1990a795c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/ErrorMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ErrorMessage.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.util;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.JdkMarshalled;
import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -28,9 +29,13 @@ import org.jetbrains.annotations.Nullable;
/**
* Message used to transfer {@link Throwable} objects.
+ * <p>
+ * Travels both transports, Communication and Discovery, and an error is an arbitrary user class the cluster may
+ * not know yet.
*/
// TODO IGNITE-28912: move to a common package.
@SuppressWarnings({"NullableProblems", "unused"})
+@JdkMarshalled
public class ErrorMessage implements MarshallableMessage {
/** Error bytes. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/distributed/SingleNodeMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/util/distributed/SingleNodeMessage.java
index 93e81660a26..fc6d5943bbe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/distributed/SingleNodeMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/distributed/SingleNodeMessage.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.util.distributed;
import java.util.UUID;
+import org.apache.ignite.internal.JdkMarshalled;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.ErrorMessage;
import org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType;
@@ -27,12 +28,16 @@ import org.jetbrains.annotations.Nullable;
/**
* Single node result message.
+ * <p>
+ * The process result travels both transports: this message carries it to the coordinator by Communication, and the
+ * coordinator puts the collected results into the {@link FullMessage} it sends by Discovery.
*
* @param <R> Result type.
* @see DistributedProcess
* @see FullMessage
* @see InitMessage
*/
+@JdkMarshalled
public class SingleNodeMessage<R extends Message> implements Message {
/** Process id. */
@Order(0)
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageMarshaller.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageMarshaller.java
index 4426ffefc62..92e4802c1dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageMarshaller.java
@@ -21,6 +21,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
import org.jetbrains.annotations.Nullable;
/**
@@ -34,22 +35,24 @@ public interface MessageMarshaller<M extends Message> {
* Marshals the message on the user thread before sending.
*
* @param msg Message to marshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
* @param cacheObjCtx Cache object context of the enclosing message, or {@code null} at the top level.
*/
- public void marshal(M msg, GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx)
+ public void marshal(M msg, Marshaller marsh, GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx)
throws IgniteCheckedException;
/**
* Unmarshals the message with full cache context and class loader.
*
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
* @param cacheObjCtx Cache object context of the enclosing message, or {@code null} at the top level.
* @param clsLdr Class loader for unmarshalling.
*/
- public void unmarshal(M msg, GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx, ClassLoader clsLdr)
- throws IgniteCheckedException;
+ public void unmarshal(M msg, Marshaller marsh, GridKernalContext kctx, @Nullable CacheObjectContext cacheObjCtx,
+ ClassLoader clsLdr) throws IgniteCheckedException;
/**
* Unmarshals the message without a cache context, using the configuration class loader — the cache-free receive
@@ -57,10 +60,11 @@ public interface MessageMarshaller<M extends Message> {
* context, so per-message marshallers need only implement the cache-aware method.
*
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
*/
- default void unmarshal(M msg, GridKernalContext kctx) throws IgniteCheckedException {
- unmarshal(msg, kctx, null, U.resolveClassLoader(kctx.config()));
+ default void unmarshal(M msg, Marshaller marsh, GridKernalContext kctx) throws IgniteCheckedException {
+ unmarshal(msg, marsh, kctx, null, U.resolveClassLoader(kctx.config()));
}
/**
@@ -68,8 +72,9 @@ public interface MessageMarshaller<M extends Message> {
* overloads, which restore the full payload later on a worker thread. No-op unless the message has {@code @NioField}s.
*
* @param msg Message to unmarshal.
+ * @param marsh Marshaller of the transport.
* @param kctx Kernal context.
*/
- default void unmarshalNio(M msg, GridKernalContext kctx) throws IgniteCheckedException {
+ default void unmarshalNio(M msg, Marshaller marsh, GridKernalContext kctx) throws IgniteCheckedException {
}
}
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryIoSession.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryIoSession.java
index e237db2cf3c..3749f3b4234 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryIoSession.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryIoSession.java
@@ -32,10 +32,11 @@ import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSocket;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.direct.DirectMessageReader;
import org.apache.ignite.internal.direct.DirectMessageWriter;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.managers.communication.DiscoveryMarshalling;
import org.apache.ignite.internal.managers.communication.UnknownMessageException;
import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.internal.util.nio.MessageSerialization;
@@ -197,7 +198,9 @@ public class TcpDiscoveryIoSession {
}
while (!finished);
- MessageMarshalling.unmarshal(msg, ((IgniteEx)spi.ignite()).context());
+ GridKernalContext kctx = ((IgniteEx)spi.ignite()).context();
+
+ DiscoveryMarshalling.unmarshal(msg, kctx);
return (T)msg;
}
@@ -241,7 +244,9 @@ public class TcpDiscoveryIoSession {
* @throws IOException If serialization fails.
*/
void serializeMessage(Message m, OutputStream out) throws IOException, IgniteCheckedException {
- MessageMarshalling.marshal(m, ((IgniteEx)spi.ignite()).context(), null);
+ GridKernalContext kctx = ((IgniteEx)spi.ignite()).context();
+
+ DiscoveryMarshalling.marshal(m, kctx, null);
msgWriter.reset();
msgWriter.setBuffer(msgBuf);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
index 5169af45414..38426511745 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
@@ -784,4 +784,21 @@ public class MessageProcessorTest {
throw new RuntimeException("Unable to locate JAR for: " + clazz.getName(), e);
}
}
+
+ /** Verifies that {@code @JdkMarshalled} makes the generated companion take the JDK marshaller of the node. */
+ @Test
+ public void testJdkMarshalledMessage() {
+ Compilation compilation = compile("TestJdkMarshalledMessage.java", "TestJdkMarshalledChildMessage.java");
+
+ assertThat(compilation).succeeded();
+
+ assertThat(compilation)
+ .generatedSourceFile("org.apache.ignite.internal.TestJdkMarshalledMessageMarshaller")
+ .hasSourceEquivalentTo(javaFile("TestJdkMarshalledMessageMarshaller.java"));
+
+ // The pin belongs to the message, so a subclass marshals the inherited fields the same way.
+ assertThat(compilation)
+ .generatedSourceFile("org.apache.ignite.internal.TestJdkMarshalledChildMessageMarshaller")
+ .hasSourceEquivalentTo(javaFile("TestJdkMarshalledChildMessageMarshaller.java"));
+ }
}
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 84600db1dd0..e9874e03055 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
@@ -31,7 +31,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.TransactionIsolation;
import org.junit.Test;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
@@ -51,7 +50,7 @@ public class DirectMarshallingMessagesTest extends GridCommonAbstractTest {
/** Message factory. */
private final MessageFactory msgFactory =
new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {
- new CoreMessagesProvider(jdk(), jdk()),
+ new CoreMessagesProvider(),
factory -> factory.register(TestNestedContainersMessage.TYPE, new TestNestedContainersMessageSerializer())
});
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteCoreMessagesSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteCoreMessagesSerializationTest.java
index 2eb6c7e640b..3336617cb6f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteCoreMessagesSerializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteCoreMessagesSerializationTest.java
@@ -27,13 +27,12 @@ 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 IgniteCoreMessagesSerializationTest extends AbstractMessageSerializationTest {
/** {@inheritDoc} */
@Override protected MessageFactoryProvider messageFactory() {
- return new CoreMessagesProvider(jdk(), jdk());
+ return new CoreMessagesProvider();
}
/** {@inheritDoc} */
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 e42db5f9639..046dbbb6f55 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
@@ -42,7 +42,6 @@ import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.Test;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -50,7 +49,7 @@ import static org.junit.Assert.assertTrue;
public class CompressedMessageTest {
/** */
private static final MessageFactory MSG_FACTORY = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{
- new CoreMessagesProvider(jdk(), jdk())});
+ new CoreMessagesProvider()});
/** */
@Test
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerOrderedUnmarshalFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerOrderedUnmarshalFailureTest.java
index e7dadfbd7e0..4b51337eac0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerOrderedUnmarshalFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerOrderedUnmarshalFailureTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.AbstractTestPluginProvider;
import org.apache.ignite.plugin.ExtensionRegistry;
import org.apache.ignite.plugin.PluginContext;
@@ -242,13 +243,15 @@ public class GridIoManagerOrderedUnmarshalFailureTest extends GridCommonAbstract
/** Fails the unmarshal of the flagged messages. */
private static class FailingMarshaller implements MessageMarshaller<FailingUnmarshalMessage> {
/** {@inheritDoc} */
- @Override public void marshal(FailingUnmarshalMessage msg, GridKernalContext kctx,
+ @Override public void marshal(FailingUnmarshalMessage msg,
+ Marshaller marsh,
+ GridKernalContext kctx,
@Nullable CacheObjectContext cacheObjCtx) {
// No-op.
}
/** {@inheritDoc} */
- @Override public void unmarshal(FailingUnmarshalMessage msg, GridKernalContext kctx,
+ @Override public void unmarshal(FailingUnmarshalMessage msg, Marshaller marsh, GridKernalContext kctx,
@Nullable CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
if (msg.fail)
throw new IgniteCheckedException("Failed payload");
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/MessageFactoryMarshallerInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/MessageFactoryMarshallerInitializationTest.java
deleted file mode 100644
index b4f8532b9df..00000000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/MessageFactoryMarshallerInitializationTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.io.Serializable;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.plugin.AbstractMessageFactoryProvider;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.plugin.AbstractTestPluginProvider;
-import org.apache.ignite.plugin.ExtensionRegistry;
-import org.apache.ignite.plugin.PluginContext;
-import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/** */
-public class MessageFactoryMarshallerInitializationTest extends GridCommonAbstractTest {
- /** */
- private static final AtomicInteger initCnt = new AtomicInteger();
-
- /** */
- public MessageFactoryMarshallerInitializationTest() {
- super(false);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- initCnt.set(0);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
-
- stopAllGrids();
- }
-
- /** */
- @Test
- public void testInitFromPlugin() throws Exception {
- checkInits(
- getConfiguration().setPluginProviders(new PluginWithMessageFactory()),
- 1);
- }
-
- /** */
- @Test
- public void testInitFromDiscovery() throws Exception {
- checkInits(
- getConfiguration().setDiscoverySpi(new DiscoverySpiWithExtraFactory()),
- 1);
- }
-
- /** */
- @Test
- public void testInitFromPluginAndDiscovery() throws Exception {
- checkInits(
- getConfiguration()
- .setPluginProviders(new PluginWithMessageFactory())
- .setDiscoverySpi(new DiscoverySpiWithExtraFactory()),
- 2);
- }
-
- /**
- * @param cfg Configuration.
- * @param exp Expected count.
- */
- private void checkInits(IgniteConfiguration cfg, int exp) throws Exception {
- assertEquals(0, initCnt.get());
-
- startGrid(cfg);
-
- assertEquals(exp, initCnt.get());
- }
-
- /** Message factory provider, which counts initializations. */
- private static class TestMessageFactoryProvider extends AbstractMessageFactoryProvider {
- /** {@inheritDoc} */
- @Override public void registerAll(IgniteMessageFactory factory) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void init(Marshaller dfltMarsh, Marshaller schemaAwareMarsh) {
- super.init(dfltMarsh, schemaAwareMarsh);
-
- initCnt.incrementAndGet();
- }
- }
-
- /** */
- private static class PluginWithMessageFactory extends AbstractTestPluginProvider {
- /** {@inheritDoc} */
- @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) {
- super.initExtensions(ctx, registry);
-
- registry.registerExtension(MessageFactoryProvider.class, new TestMessageFactoryProvider());
- }
-
- /** {@inheritDoc} */
- @Override public String name() {
- return "PluginWithMessageFactory";
- }
-
- /** {@inheritDoc} */
- @Override public void validateNewNode(ClusterNode node, Serializable data) {
- super.validateNewNode(node, data);
- }
- }
-
- /** */
- private static class DiscoverySpiWithExtraFactory extends TcpDiscoverySpi {
- /** {@inheritDoc} */
- @Override public MessageFactoryProvider messageFactoryProvider() {
- return new TestMessageFactoryProvider();
- }
- }
-}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponseUnmarshalTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponseUnmarshalTest.java
index 1c7333bcf12..43cf3001011 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponseUnmarshalTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponseUnmarshalTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache.query;
import java.util.List;
import java.util.Map;
import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.processors.cache.CacheObjectNotResolvedException;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -68,13 +68,13 @@ public class GridCacheQueryResponseUnmarshalTest extends GridCommonAbstractTest
res.data(List.of(new T2<>(key, "row")));
- MessageMarshalling.marshal(res, kctx, null);
+ CommunicationMarshalling.marshal(res, kctx, null);
GridCacheQueryResponse rcvd = new GridCacheQueryResponse(cctx.cacheId(), 0, true, false);
rcvd.dataBytes = res.dataBytes;
- MessageMarshalling.unmarshal(rcvd, kctx, null, getClass().getClassLoader());
+ CommunicationMarshalling.unmarshal(rcvd, kctx, null, getClass().getClassLoader());
Map.Entry<?, ?> row = (Map.Entry<?, ?>)rcvd.data().iterator().next();
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 470d0d0363c..45a5fb3381f 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
@@ -45,7 +45,6 @@ import org.junit.Test;
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;
/**
*
@@ -194,7 +193,7 @@ public class IgniteCacheContinuousQueryImmutableEntryTest extends GridCommonAbst
/** @return Entry read back from the bytes {@code e} is written to. */
private CacheContinuousQueryEntry roundTrip(CacheContinuousQueryEntry e) throws Exception {
IgniteMessageFactoryImpl msgFactory =
- new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new CoreMessagesProvider(jdk(), jdk())});
+ new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new CoreMessagesProvider()});
ByteBuffer buf = ByteBuffer.allocate(4096);
DirectMessageWriter writer = new DirectMessageWriter(msgFactory);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java
index 793d95f0159..545b44c776e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java
@@ -25,9 +25,9 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMessageDeployer;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -67,8 +67,10 @@ public class TxDeadlockDetectionMessageMarshallingTest extends GridCommonAbstrac
@Override public void onMessage(UUID nodeId, Object msg, byte plc) {
if (msg instanceof TxLocksResponse) {
try {
- MessageMarshalling.unmarshal((TxLocksResponse)msg,
- clientCtx.kernalContext(), null, clientCtx.deploy().globalLoader());
+ CommunicationMarshalling.unmarshal((TxLocksResponse)msg,
+ clientCtx.kernalContext(),
+ null,
+ clientCtx.deploy().globalLoader());
res.set(true);
}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
index f38ccc03b31..498a21c6b2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
@@ -46,8 +46,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.GridTopicMessage;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
@@ -806,7 +806,7 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
);
try {
- MessageMarshalling.marshal(msg, ((IgniteEx)ignite).context(), null);
+ CommunicationMarshalling.marshal(msg, ((IgniteEx)ignite).context(), null);
}
catch (IgniteCheckedException e) {
throw new RuntimeException(e);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/query/schema/message/QueryEntityMessageSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/query/schema/message/QueryEntityMessageSerializationTest.java
index a639322a976..f7fea391425 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/query/schema/message/QueryEntityMessageSerializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/query/schema/message/QueryEntityMessageSerializationTest.java
@@ -35,13 +35,11 @@ import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.internal.CoreMessagesProvider;
import org.apache.ignite.internal.direct.DirectMessageReader;
import org.apache.ignite.internal.direct.DirectMessageWriter;
+import org.apache.ignite.internal.managers.communication.DiscoveryMarshalling;
import org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.processors.query.QueryEntityEx;
import org.apache.ignite.internal.processors.query.schema.operation.SchemaAddQueryEntityOperation;
import org.apache.ignite.internal.util.nio.MessageSerialization;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
@@ -51,7 +49,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
import static org.apache.ignite.internal.util.CommonUtils.makeMessageType;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
/** Test for serialization round-trip of {@link QueryEntityMessage} and {@link QueryEntityExMessage}. */
public class QueryEntityMessageSerializationTest extends GridCommonAbstractTest {
@@ -72,12 +69,9 @@ public class QueryEntityMessageSerializationTest extends GridCommonAbstractTest
"price", new BigDecimal("9.99"),
"id", 42);
- /** */
- private final Marshaller marsh = jdk();
-
/** */
private final MessageFactory<?> msgFactory = new IgniteMessageFactoryImpl<>(
- new MessageFactoryProvider[] {new CoreMessagesProvider(marsh, marsh)});
+ new MessageFactoryProvider[] {new CoreMessagesProvider()});
/** */
@Test
@@ -172,7 +166,7 @@ public class QueryEntityMessageSerializationTest extends GridCommonAbstractTest
GridTestUtils.setFieldValue(kctx.grid(), "msgFactory", msgFactory);
- MessageMarshalling.marshal(msg, kctx, null);
+ DiscoveryMarshalling.marshal(msg, kctx, null);
ByteBuffer buf = ByteBuffer.allocate(64 * 1024);
@@ -194,7 +188,7 @@ public class QueryEntityMessageSerializationTest extends GridCommonAbstractTest
assertEquals("Reads" + ERROR_SUFFIX,
expReadsWritesCnt, reader.state());
- MessageMarshalling.unmarshal(res, kctx, null, U.gridClassLoader());
+ DiscoveryMarshalling.unmarshal(res, kctx);
return res;
}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/LazyServiceConfigurationMessageSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/LazyServiceConfigurationMessageSerializationTest.java
index e35fd1dec57..1536b53e992 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/LazyServiceConfigurationMessageSerializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/LazyServiceConfigurationMessageSerializationTest.java
@@ -26,11 +26,9 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.CoreMessagesProvider;
import org.apache.ignite.internal.direct.DirectMessageReader;
import org.apache.ignite.internal.direct.DirectMessageWriter;
+import org.apache.ignite.internal.managers.communication.DiscoveryMarshalling;
import org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.util.nio.MessageSerialization;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
@@ -40,7 +38,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
import static org.apache.ignite.internal.util.CommonUtils.makeMessageType;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.junit.Assert.assertArrayEquals;
/** Test for serialization round-trip of {@link LazyServiceConfigurationMessage}. */
@@ -49,12 +46,9 @@ public class LazyServiceConfigurationMessageSerializationTest extends GridCommon
public static final String ERROR_SUFFIX = " count is not equal to the expected fields count. " +
"Has the number of fields in the `LazyServiceConfiguration` class changed?";
- /** */
- private final Marshaller marsh = jdk();
-
/** */
private final MessageFactory msgFactory = new IgniteMessageFactoryImpl(
- new MessageFactoryProvider[] {new CoreMessagesProvider(marsh, marsh)});
+ new MessageFactoryProvider[] {new CoreMessagesProvider()});
/**
* ServiceConfiguration declares {@code svc}, {@code nodeFilter}, {@code interceptors} as non-transient,
@@ -125,7 +119,7 @@ public class LazyServiceConfigurationMessageSerializationTest extends GridCommon
GridTestUtils.setFieldValue(kctx.grid(), "msgFactory", msgFactory);
- MessageMarshalling.marshal(msg, kctx, null);
+ DiscoveryMarshalling.marshal(msg, kctx, null);
ByteBuffer buf = ByteBuffer.allocate(64 * 1024);
@@ -145,7 +139,7 @@ public class LazyServiceConfigurationMessageSerializationTest extends GridCommon
assertTrue(MessageSerialization.readFrom(msgFactory, res, reader));
assertEquals("Reads" + ERROR_SUFFIX, expReadsWritesCnt, reader.state());
- MessageMarshalling.unmarshal(res, kctx, null, U.gridClassLoader());
+ DiscoveryMarshalling.unmarshal(res, kctx);
return res;
}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/distributed/DistributedProcessResultMarshallingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/distributed/DistributedProcessResultMarshallingTest.java
new file mode 100644
index 00000000000..0286297db11
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/distributed/DistributedProcessResultMarshallingTest.java
@@ -0,0 +1,323 @@
+/*
+ * 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.util.distributed;
+
+import java.util.Collection;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.CoreMessagesProvider;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.managers.communication.CommunicationMarshalling;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.util.ErrorMessage;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.Marshallers;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
+import org.apache.ignite.plugin.AbstractTestPluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.PluginContext;
+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.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.TEST_PROCESS;
+import static org.apache.ignite.testframework.GridTestUtils.loadSerializer;
+
+/**
+ * Tests that the result of a {@link DistributedProcess} is marshalled with the JDK marshaller on both transports.
+ * <p>
+ * The coordinator starts the process with an {@link InitMessage} sent by Discovery, every node answers with its own
+ * result inside a {@link SingleNodeMessage} sent by Communication, and the coordinator collects those results and
+ * sends them back in a {@link FullMessage} by Discovery. A marshalled field caches its wire form, so the result
+ * cannot be written by one marshaller and read by another.
+ */
+public class DistributedProcessResultMarshallingTest extends GridCommonAbstractTest {
+ /** Timeout to wait latches. */
+ private static final long TIMEOUT = 20_000L;
+
+ /** Nodes count. */
+ private static final int NODES_CNT = 2;
+
+ /** Direct type of the process request, past the core range. */
+ private static final short TYPE = (short)(CoreMessagesProvider.MAX_MESSAGE_ID + 1);
+
+ /** Direct type of the process result. */
+ private static final short PAYLOAD_TYPE = (short)(CoreMessagesProvider.MAX_MESSAGE_ID + 2);
+
+ /** Marshallers the payload of the process result was handed, on every leg it travels. */
+ private static final Collection<Marshaller> PAYLOAD_MARSH = new ConcurrentLinkedQueue<>();
+
+ /** Marshallers of the communication leg: those the payload got before the single node message went out. */
+ private static final Collection<Marshaller> COMM_MARSH = new ConcurrentLinkedQueue<>();
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ // The message is marshalled by the sending thread, so by the time the SPI sees it the communication leg is done.
+ cfg.setCommunicationSpi(new TestRecordingCommunicationSpi() {
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) {
+ if (msg instanceof GridIoMessage && ((GridIoMessage)msg).message() instanceof SingleNodeMessage)
+ COMM_MARSH.addAll(PAYLOAD_MARSH);
+
+ super.sendMessage(node, msg, ackC);
+ }
+ });
+
+ cfg.setPluginProviders(new AbstractTestPluginProvider() {
+ @Override public String name() {
+ return "distributed-process-result-marshalling";
+ }
+
+ @Override public void initExtensions(PluginContext pluginCtx, ExtensionRegistry registry) {
+ registry.registerExtension(MessageFactoryProvider.class, factory -> {
+ factory.register(TYPE, loadSerializer(TestIntegerMessage.class));
+ factory.register(PAYLOAD_TYPE, new PayloadSerializer(), new PayloadMarshaller());
+ });
+ }
+ });
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ PAYLOAD_MARSH.clear();
+ COMM_MARSH.clear();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /** @throws Exception If failed. */
+ @Test
+ public void testResultIsMarshalledWithJdkOnCommunication() throws Exception {
+ startGrids(NODES_CNT);
+
+ CountDownLatch finishLatch = new CountDownLatch(NODES_CNT);
+
+ DistributedProcess<TestIntegerMessage, PayloadMessage> initiator = null;
+
+ for (Ignite grid : G.allGrids()) {
+ // An already finished future makes DistributedProcess send the result inline, on the discovery thread.
+ DistributedProcess<TestIntegerMessage, PayloadMessage> p = new DistributedProcess<>(
+ ((IgniteEx)grid).context(),
+ TEST_PROCESS,
+ (uuid, req) -> new GridFinishedFuture<>(new PayloadMessage(UUID.randomUUID())),
+ (uuid, res, err) -> finishLatch.countDown()
+ );
+
+ if (grid == grid(0))
+ initiator = p;
+ }
+
+ initiator.start(UUID.randomUUID(), new TestIntegerMessage(1));
+
+ assertTrue("The process has not finished", finishLatch.await(TIMEOUT, MILLISECONDS));
+
+ // The result goes to the coordinator by communication and comes back in the FullMessage by discovery.
+ assertFalse("The result never went out by communication, the test proves nothing", COMM_MARSH.isEmpty());
+
+ assertTrue("The result never travelled discovery, the test proves half of what it claims",
+ PAYLOAD_MARSH.size() > COMM_MARSH.size());
+
+ for (Marshaller marsh : PAYLOAD_MARSH) {
+ assertTrue("The result of a distributed process must be marshalled with the JDK marshaller on every "
+ + "transport, so that the discovery leg reads the wire form the communication leg has cached, but got "
+ + marsh, marsh instanceof JdkMarshaller);
+ }
+ }
+
+
+ /**
+ * A pin belongs to the message that carries it, so a pinned message nested into a message that is not pinned is
+ * still marshalled with the JDK marshaller, whatever its parent got from the transport.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testNestedPinnedMessageKeepsItsMarshaller() throws Exception {
+ startGrids(NODES_CNT);
+
+ PayloadMessage msg = new PayloadMessage(UUID.randomUUID());
+
+ // Communication hands the schema-aware marshaller over, and the payload of the parent takes it.
+ CommunicationMarshalling.marshal(msg, grid(0).context(), null);
+
+ assertTrue("The parent was marshalled with " + PAYLOAD_MARSH, PAYLOAD_MARSH.stream().noneMatch(m -> m instanceof JdkMarshaller));
+
+ assertNotNull("The nested message was not marshalled", msg.err.errBytes);
+
+ // Only the JDK marshaller reads what the JDK marshaller wrote, so a successful read is the proof.
+ Object err;
+
+ try {
+ err = U.unmarshal(Marshallers.jdk(), msg.err.errBytes, U.gridClassLoader());
+ }
+ catch (IgniteCheckedException e) {
+ throw new AssertionError("A pinned message nested into a plain one must still go through the JDK "
+ + "marshaller, but its wire form is not a JDK stream", e);
+ }
+
+ assertTrue("The nested message carries " + err, err instanceof IllegalStateException);
+ }
+
+ /**
+ * Result of the process. It carries an object field, so that the payload really goes through a marshaller, and it
+ * carries no {@code JdkMarshalled} of its own: the test checks that pinning {@link SingleNodeMessage} covers every
+ * result, including the ones written later.
+ */
+ public static class PayloadMessage implements Message {
+ /** Payload. */
+ private Object val;
+
+ /** Wire form of {@link #val}. */
+ private byte[] valBytes;
+
+ /** A pinned message nested into a message that is not pinned itself. */
+ private ErrorMessage err;
+
+ /** Default constructor for {@link MessageFactory}. */
+ public PayloadMessage() {
+ // No-op.
+ }
+
+ /** @param val Payload. */
+ PayloadMessage(Object val) {
+ this.val = val;
+ this.err = new ErrorMessage(new IllegalStateException("nested"));
+ }
+
+ /** {@inheritDoc} */
+ @Override public short directType() {
+ return PAYLOAD_TYPE;
+ }
+ }
+
+ /** */
+ private static class PayloadSerializer implements MessageSerializer<PayloadMessage> {
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(PayloadMessage msg, MessageWriter writer) {
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(msg.directType()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeByteArray(msg.valBytes))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeMessage(msg.err))
+ return false;
+
+ writer.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(PayloadMessage msg, MessageReader reader) {
+ switch (reader.state()) {
+ case 0:
+ msg.valBytes = reader.readByteArray();
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ msg.err = reader.readMessage();
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public PayloadMessage createMessage() {
+ return new PayloadMessage();
+ }
+ }
+
+ /** Marshals the payload with whatever marshaller the caller hands over - the test asserts which one that is. */
+ private static class PayloadMarshaller implements MessageMarshaller<PayloadMessage> {
+ /** {@inheritDoc} */
+ @Override public void marshal(PayloadMessage msg, Marshaller marsh, GridKernalContext kctx,
+ CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ PAYLOAD_MARSH.add(marsh);
+
+ if (msg.val != null && msg.valBytes == null)
+ msg.valBytes = U.marshal(marsh, msg.val);
+
+ if (msg.err != null)
+ MessageMarshalling.marshal(msg.err, marsh, kctx, cacheObjCtx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void unmarshal(PayloadMessage msg, Marshaller marsh, GridKernalContext kctx,
+ CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ if (msg.err != null)
+ MessageMarshalling.unmarshal(msg.err, marsh, kctx, cacheObjCtx, clsLdr);
+
+ if (msg.valBytes != null) {
+ msg.val = U.unmarshal(marsh, msg.valBytes, clsLdr);
+
+ msg.valBytes = null;
+ }
+ }
+ }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/plugin/extensions/communication/MessageMarshalOnceTest.java b/modules/core/src/test/java/org/apache/ignite/plugin/extensions/communication/MessageMarshalOnceTest.java
index ad731b0ab2e..12f4e34afed 100644
--- a/modules/core/src/test/java/org/apache/ignite/plugin/extensions/communication/MessageMarshalOnceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/plugin/extensions/communication/MessageMarshalOnceTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.AbstractTestPluginProvider;
import org.apache.ignite.plugin.ExtensionRegistry;
import org.apache.ignite.plugin.PluginContext;
@@ -181,18 +182,18 @@ public class MessageMarshalOnceTest extends GridCommonAbstractTest {
/** Marshaller that only counts {@code marshal} calls — no idempotency guard, so it counts raw invocations. */
private static class CountingMarshaller implements MessageMarshaller<MarshalOnceCheckMessage> {
/** {@inheritDoc} */
- @Override public void marshal(MarshalOnceCheckMessage msg, GridKernalContext kctx, CacheObjectContext nested) {
+ @Override public void marshal(MarshalOnceCheckMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext nested) {
MARSHAL_CNT.incrementAndGet();
}
/** {@inheritDoc} */
- @Override public void unmarshal(MarshalOnceCheckMessage msg, GridKernalContext kctx, CacheObjectContext nested,
+ @Override public void unmarshal(MarshalOnceCheckMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext nested,
ClassLoader clsLdr) {
// No-op.
}
/** {@inheritDoc} */
- @Override public void unmarshal(MarshalOnceCheckMessage msg, GridKernalContext kctx) {
+ @Override public void unmarshal(MarshalOnceCheckMessage msg, Marshaller marsh, GridKernalContext kctx) {
// No-op.
}
}
@@ -233,18 +234,18 @@ public class MessageMarshalOnceTest extends GridCommonAbstractTest {
/** Marshaller that only counts {@code marshal} calls of {@link RetryCheckMessage}. */
private static class RetryCountingMarshaller implements MessageMarshaller<RetryCheckMessage> {
/** {@inheritDoc} */
- @Override public void marshal(RetryCheckMessage msg, GridKernalContext kctx, CacheObjectContext nested) {
+ @Override public void marshal(RetryCheckMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext nested) {
RETRY_MARSHAL_CNT.incrementAndGet();
}
/** {@inheritDoc} */
- @Override public void unmarshal(RetryCheckMessage msg, GridKernalContext kctx, CacheObjectContext nested,
+ @Override public void unmarshal(RetryCheckMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext nested,
ClassLoader clsLdr) {
// No-op.
}
/** {@inheritDoc} */
- @Override public void unmarshal(RetryCheckMessage msg, GridKernalContext kctx) {
+ @Override public void unmarshal(RetryCheckMessage msg, Marshaller marsh, GridKernalContext kctx) {
// No-op.
}
}
diff --git a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSetSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSetSerializationTest.java
index 7d3a472cefd..2d13187a975 100644
--- a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSetSerializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSetSerializationTest.java
@@ -36,7 +36,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
import static org.apache.ignite.internal.util.CommonUtils.makeMessageType;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.plugin.security.SecurityPermission.ADMIN_CACHE;
import static org.apache.ignite.plugin.security.SecurityPermission.ADMIN_QUERY;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_CREATE;
@@ -50,7 +49,7 @@ import static org.apache.ignite.plugin.security.SecurityPermission.TASK_EXECUTE;
public class SecurityBasicPermissionSetSerializationTest extends GridCommonAbstractTest {
/** */
private final MessageFactory<? extends Message> msgFactory = new IgniteMessageFactoryImpl<>(
- new MessageFactoryProvider[] {new CoreMessagesProvider(jdk(), jdk())});
+ new MessageFactoryProvider[] {new CoreMessagesProvider()});
/** */
@Test
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/MessagesPluginProvider.java b/modules/core/src/test/java/org/apache/ignite/spi/MessagesPluginProvider.java
index 69a654b2c96..1198584d229 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/MessagesPluginProvider.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/MessagesPluginProvider.java
@@ -24,9 +24,12 @@ import org.apache.ignite.plugin.ExtensionRegistry;
import org.apache.ignite.plugin.PluginContext;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
+import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi;
+import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.testframework.GridTestUtils.loadMarshaller;
import static org.apache.ignite.testframework.GridTestUtils.loadSerializer;
/**
@@ -43,13 +46,28 @@ public class MessagesPluginProvider extends AbstractTestPluginProvider {
short directType = CoreMessagesProvider.MAX_MESSAGE_ID + 1;
for (Class<? extends Message> msg : msgs) {
- f.register(directType, loadSerializer(msg));
+ f.register(directType, loadSerializer(msg), marshaller(msg));
directType++;
}
};
}
+ /**
+ * A marshaller companion is generated only for a message that has something to marshal, and the loader throws
+ * when there is no such class. Test messages are mostly plain, so a missing companion is the normal case here.
+ *
+ * @return Generated marshaller of the message, or {@code null} when the message has nothing to marshal.
+ */
+ private static <T extends Message> @Nullable MessageMarshaller<T> marshaller(Class<? extends Message> msg) {
+ try {
+ return loadMarshaller(msg);
+ }
+ catch (RuntimeException ignored) {
+ return null;
+ }
+ }
+
/** {@inheritDoc} */
@Override public String name() {
return "Test messages plugin";
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 d15252f771b..d31c1c358fe 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
@@ -45,7 +45,6 @@ import org.apache.ignite.testframework.junits.IgniteTestResources;
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.
@@ -154,7 +153,7 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
GridSpiTestContext ctx = initSpiContext();
ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {
- new CoreMessagesProvider(jdk(), jdk()), customMessageFactory()}));
+ new CoreMessagesProvider(), customMessageFactory()}));
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 0c02503cc9c..10ce42d791c 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
@@ -63,7 +63,6 @@ import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.apache.ignite.testframework.junits.spi.GridSpiTest;
import org.junit.Test;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
/**
@@ -434,7 +433,7 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends Communic
GridSpiTestContext ctx = initSpiContext();
ctx.messageFactory(new IgniteMessageFactoryImpl(
- new MessageFactoryProvider[] {new CoreMessagesProvider(jdk(), jdk()), GRID_TEST_MESSAGE_FACTORY})
+ new MessageFactoryProvider[] {new CoreMessagesProvider(), GRID_TEST_MESSAGE_FACTORY})
);
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 ad5805e0bb4..4d6f35c3e46 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,7 +58,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_TCP_COMM_SET_ATTR_
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.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
import static org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.ATTR_HOST_NAMES;
import static org.apache.ignite.testframework.GridTestUtils.getFreeCommPort;
@@ -252,7 +251,7 @@ public class GridTcpCommunicationSpiConfigSelfTest extends GridSpiAbstractConfig
node.setId(rsrcs.getNodeId());
ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{
- new CoreMessagesProvider(jdk(), jdk()), GRID_TEST_MESSAGE_FACTORY}));
+ new CoreMessagesProvider(), GRID_TEST_MESSAGE_FACTORY}));
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 2d1f084daf9..5629dfb2a8c 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,7 +64,6 @@ import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.junit.Test;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
/**
@@ -468,7 +467,7 @@ public class GridTcpCommunicationSpiMultithreadedSelfTest extends GridSpiAbstrac
GridSpiTestContext ctx = initSpiContext();
ctx.messageFactory(new IgniteMessageFactoryImpl(
- new MessageFactoryProvider[] {new CoreMessagesProvider(jdk(), jdk()), GRID_TEST_MESSAGE_FACTORY})
+ new MessageFactoryProvider[] {new CoreMessagesProvider(), GRID_TEST_MESSAGE_FACTORY})
);
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 a56a636b49b..2e917f895e3 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
@@ -54,7 +54,6 @@ import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.apache.ignite.testframework.junits.spi.GridSpiTest;
import org.junit.Test;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
/**
@@ -400,7 +399,7 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
GridSpiTestContext ctx = initSpiContext();
ctx.messageFactory(new IgniteMessageFactoryImpl(
- new MessageFactoryProvider[] {new CoreMessagesProvider(jdk(), jdk()), GRID_TEST_MESSAGE_FACTORY})
+ new MessageFactoryProvider[] {new CoreMessagesProvider(), GRID_TEST_MESSAGE_FACTORY})
);
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 e3ef6213d11..09bf1692492 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,7 +59,6 @@ import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.apache.ignite.testframework.junits.spi.GridSpiTest;
import org.junit.Test;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
/**
@@ -729,7 +728,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi<
GridSpiTestContext ctx = initSpiContext();
ctx.messageFactory(new IgniteMessageFactoryImpl(
- new MessageFactoryProvider[] {new CoreMessagesProvider(jdk(), jdk()), GRID_TEST_MESSAGE_FACTORY})
+ new MessageFactoryProvider[] {new CoreMessagesProvider(), GRID_TEST_MESSAGE_FACTORY})
);
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 28420e04479..8344c2c2271 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
@@ -57,7 +57,6 @@ import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.apache.ignite.testframework.junits.spi.GridSpiTest;
import org.junit.Test;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
/**
@@ -453,7 +452,7 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
GridSpiTestContext ctx = initSpiContext();
ctx.messageFactory(new IgniteMessageFactoryImpl(
- new MessageFactoryProvider[] {new CoreMessagesProvider(jdk(), jdk()), GRID_TEST_MESSAGE_FACTORY})
+ new MessageFactoryProvider[] {new CoreMessagesProvider(), GRID_TEST_MESSAGE_FACTORY})
);
ctx.setLocalNode(node);
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/DiscoveryUnmarshalVulnerabilityTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/DiscoveryUnmarshalVulnerabilityTest.java
index b5e2c457ffe..5a4e18fe8d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/DiscoveryUnmarshalVulnerabilityTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/DiscoveryUnmarshalVulnerabilityTest.java
@@ -36,11 +36,12 @@ import org.apache.ignite.internal.CoreMessagesProvider;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.direct.DirectMessageWriter;
+import org.apache.ignite.internal.managers.communication.DiscoveryMarshalling;
import org.apache.ignite.internal.managers.communication.IgniteMessageFactory;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.plugin.AbstractMessageFactoryProvider;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.Marshallers;
import org.apache.ignite.plugin.AbstractTestPluginProvider;
import org.apache.ignite.plugin.ExtensionRegistry;
@@ -251,7 +252,7 @@ public abstract class DiscoveryUnmarshalVulnerabilityTest extends GridCommonAbst
ExploitMessage msg = new ExploitMessage(new Exploit());
- MessageMarshalling.marshal(msg, grid(0).context(), null);
+ DiscoveryMarshalling.marshal(msg, grid(0).context(), null);
writer.writeMessage(msg);
@@ -308,35 +309,36 @@ public abstract class DiscoveryUnmarshalVulnerabilityTest extends GridCommonAbst
private final AtomicBoolean init = new AtomicBoolean(true);
/** */
- private MessageMarshaller<ExploitMessage> marsh;
+ private MessageMarshaller<ExploitMessage> delegate;
/** {@inheritDoc} */
- @Override public void marshal(ExploitMessage msg, GridKernalContext kctx, CacheObjectContext nested)
- throws IgniteCheckedException {
+ @Override public void marshal(ExploitMessage msg, Marshaller marsh, GridKernalContext kctx,
+ CacheObjectContext nested) throws IgniteCheckedException {
initIfNecessary();
- marsh.marshal(msg, kctx, nested);
+ delegate.marshal(msg, marsh, kctx, nested);
}
/** {@inheritDoc} */
- @Override public void unmarshal(ExploitMessage msg, GridKernalContext kctx, CacheObjectContext nested, ClassLoader clsLdr)
- throws IgniteCheckedException {
+ @Override public void unmarshal(ExploitMessage msg, Marshaller marsh, GridKernalContext kctx,
+ CacheObjectContext nested, ClassLoader clsLdr) throws IgniteCheckedException {
initIfNecessary();
- marsh.unmarshal(msg, kctx, nested, clsLdr);
+ delegate.unmarshal(msg, marsh, kctx, nested, clsLdr);
}
/** {@inheritDoc} */
- @Override public void unmarshal(ExploitMessage msg, GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void unmarshal(ExploitMessage msg, Marshaller marsh, GridKernalContext kctx)
+ throws IgniteCheckedException {
initIfNecessary();
- marsh.unmarshal(msg, kctx);
+ delegate.unmarshal(msg, marsh, kctx);
}
/** */
private void initIfNecessary() {
if (init.get() && init.compareAndSet(true, false))
- marsh = loadMarshaller(ExploitMessage.class, Marshallers.jdk());
+ delegate = loadMarshaller(ExploitMessage.class);
}
}
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java
index 33a8af3ce29..e1133dfd06c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java
@@ -35,7 +35,6 @@ import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.GridTestUtils.DiscoveryHook;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.testframework.GridTestUtils.DiscoverySpiListenerWrapper.wrap;
/**
@@ -124,7 +123,7 @@ public class TestTcpDiscoverySpi extends TcpDiscoverySpi implements IgniteDiscov
assert !started();
msgFactory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {
- new CoreMessagesProvider(jdk(), jdk()),
+ new CoreMessagesProvider(),
msgFactoryProvider
});
}
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 4b513005fc4..833b9e36891 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
@@ -74,7 +74,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
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 +551,7 @@ public class GridSpiTestContext implements IgniteSpiContext {
/** {@inheritDoc} */
@Override public MessageFactory messageFactory() {
if (factory == null)
- factory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new CoreMessagesProvider(jdk(), jdk())});
+ factory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{new CoreMessagesProvider()});
return factory;
}
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 66682fb1bd2..02e9a4d21d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -102,7 +102,6 @@ import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.MarshallableMessage;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -129,7 +128,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
@@ -149,7 +147,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_HOME;
import static org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION;
import static org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.partitionFileName;
import static org.apache.ignite.internal.util.lang.ClusterNodeFunc.nodeIds;
-import static org.apache.ignite.marshaller.Marshallers.jdk;
import static org.apache.ignite.ssl.SslContextFactory.DFLT_KEY_ALGORITHM;
import static org.apache.ignite.ssl.SslContextFactory.DFLT_SSL_PROTOCOL;
import static org.apache.ignite.ssl.SslContextFactory.DFLT_STORE_TYPE;
@@ -2717,20 +2714,12 @@ public final class GridTestUtils {
}
}
- /** Loads the generated {@code *Marshaller} class for {@code msgCls} and instantiates it with {@code dfltMarsh}. */
- public static <T extends Message> MessageMarshaller<T> loadMarshaller(Class<? extends Message> msgCls,
- @Nullable Marshaller dfltMarsh) {
+ /** Loads the generated {@code *Marshaller} class for {@code msgCls}; the marshaller is passed per call, not held. */
+ public static <T extends Message> MessageMarshaller<T> loadMarshaller(Class<? extends Message> msgCls) {
try {
Class<?> marshallerCls = U.gridClassLoader()
.loadClass(msgCls.getPackage().getName() + "." + msgCls.getSimpleName() + "Marshaller");
- boolean isMarshallable = MarshallableMessage.class.isAssignableFrom(msgCls);
-
- if (isMarshallable) {
- Marshaller marsh = dfltMarsh != null ? dfltMarsh : jdk();
- return (MessageMarshaller<T>)marshallerCls.getConstructor(Marshaller.class).newInstance(marsh);
- }
-
return (MessageMarshaller<T>)U.newInstance(marshallerCls);
}
catch (Exception e) {
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index c419cf9bcbb..19e63c8a785 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -153,7 +153,7 @@ public class IgniteMock implements IgniteEx {
this.staticCfg = staticCfg;
msgFactory = new IgniteMessageFactoryImpl(new MessageFactoryProvider[] {
- new CoreMessagesProvider(marshaller, marshaller)});
+ new CoreMessagesProvider()});
try {
kernalCtx = new StandaloneGridKernalContext(new GridTestLog4jLogger(), null) {
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 74b9ed66f36..c8ff74b6ced 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -40,7 +40,6 @@ import org.apache.ignite.internal.codegen.MessageProcessorTest;
import org.apache.ignite.internal.managers.communication.CompressedMessageTest;
import org.apache.ignite.internal.managers.communication.DefaultEnumMapperTest;
import org.apache.ignite.internal.managers.communication.GridIoManagerOrderedUnmarshalFailureTest;
-import org.apache.ignite.internal.managers.communication.MessageFactoryMarshallerInitializationTest;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentV2Test;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentV2TestNoOptimizations;
import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorRendezvousSelfTest;
@@ -167,7 +166,6 @@ import org.junit.runners.Suite;
DefaultEnumMapperTest.class,
IgniteDataTransferObjectProcessorTest.class,
CompressedMessageTest.class,
- MessageFactoryMarshallerInitializationTest.class,
LogEvictionResultsTest.class,
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index c06cbfe8fd4..ad2129d4d2e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.util.IgniteUtilsUnitTest;
import org.apache.ignite.internal.util.distributed.DistributedProcessClientAwaitTest;
import org.apache.ignite.internal.util.distributed.DistributedProcessCoordinatorLeftTest;
import org.apache.ignite.internal.util.distributed.DistributedProcessErrorHandlingTest;
+import org.apache.ignite.internal.util.distributed.DistributedProcessResultMarshallingTest;
import org.apache.ignite.internal.util.nio.GridNioDelimitedBufferSelfTest;
import org.apache.ignite.internal.util.nio.GridNioSelfTest;
import org.apache.ignite.internal.util.nio.GridNioServerTest;
@@ -147,6 +148,7 @@ import org.junit.runners.Suite;
DistributedProcessErrorHandlingTest.class,
DistributedProcessCoordinatorLeftTest.class,
DistributedProcessClientAwaitTest.class,
+ DistributedProcessResultMarshallingTest.class,
BasicRateLimiterTest.class,
diff --git a/modules/core/src/test/resources/codegen/TestCollectionsMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestCollectionsMessageMarshaller.java
index 5a9334c38d3..8b32ba796b6 100644
--- a/modules/core/src/test/resources/codegen/TestCollectionsMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestCollectionsMessageMarshaller.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.TestCollectionsMessage;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -32,7 +33,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestCollectionsMessageMarshaller implements MessageMarshaller<TestCollectionsMessage> {
/** */
- @Override public void marshal(TestCollectionsMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestCollectionsMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.cacheObjectSet != null) {
@@ -44,7 +45,7 @@ public final class TestCollectionsMessageMarshaller implements MessageMarshaller
}
/** */
- @Override public void unmarshal(TestCollectionsMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestCollectionsMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.cacheObjectSet != null) {
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java b/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessage.java
similarity index 61%
copy from modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
copy to modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessage.java
index e1d033df696..34deb7048c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
+++ b/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessage.java
@@ -15,24 +15,16 @@
* limitations under the License.
*/
-package org.apache.ignite.internal.managers.eventstorage;
+package org.apache.ignite.internal;
-import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
-import org.apache.ignite.plugin.extensions.communication.Message;
+public class TestJdkMarshalledChildMessage extends TestJdkMarshalledMessage {
+ @Marshalled("ownBytes")
+ Object own;
-/** */
-@UseBinaryMarshaller
-public class EventsDataBagItem implements Message {
- /** */
@Order(0)
- int[] enabledEvts;
+ byte[] ownBytes;
- /** */
- public EventsDataBagItem() { }
-
- /** @param enabledEvts Enabled events. */
- public EventsDataBagItem(int[] enabledEvts) {
- this.enabledEvts = enabledEvts;
+ public short directType() {
+ return 1;
}
}
diff --git a/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessageMarshaller.java
new file mode 100644
index 00000000000..30cbaf543f4
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessageMarshaller.java
@@ -0,0 +1,83 @@
+/*
+ * 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;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.TestJdkMarshalledChildMessage;
+import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
+
+/**
+ * This class is generated automatically.
+ *
+ * @see org.apache.ignite.internal.MessageProcessor
+ */
+public final class TestJdkMarshalledChildMessageMarshaller implements MessageMarshaller<TestJdkMarshalledChildMessage> {
+ /** */
+ @Override public void marshal(TestJdkMarshalledChildMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ Marshaller jdkMarsh = kctx.marshallerContext().jdkMarshaller();
+
+ CacheObjectContext ctx = cacheObjCtx;
+
+ if (msg.own != null && msg.ownBytes == null)
+ msg.ownBytes = U.marshal(jdkMarsh, msg.own);
+
+ if (msg.data != null && msg.dataBytes == null)
+ msg.dataBytes = U.marshal(jdkMarsh, msg.data);
+
+ if (msg.nested != null)
+ MessageMarshalling.marshal(msg.nested, jdkMarsh, kctx, ctx);
+
+ if (msg.nioMsg != null)
+ MessageMarshalling.marshal(msg.nioMsg, jdkMarsh, kctx, ctx);
+ }
+
+ /** */
+ @Override public void unmarshal(TestJdkMarshalledChildMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ Marshaller jdkMarsh = kctx.marshallerContext().jdkMarshaller();
+
+ CacheObjectContext ctx = cacheObjCtx;
+
+ if (msg.nested != null)
+ MessageMarshalling.unmarshal(msg.nested, jdkMarsh, kctx, ctx, clsLdr);
+
+ if (msg.ownBytes != null) {
+ msg.own = U.unmarshal(jdkMarsh, msg.ownBytes, clsLdr);
+
+ msg.ownBytes = null;
+ }
+
+ if (msg.dataBytes != null) {
+ msg.data = U.unmarshal(jdkMarsh, msg.dataBytes, clsLdr);
+
+ msg.dataBytes = null;
+ }
+ }
+
+ /** */
+ @Override public void unmarshalNio(TestJdkMarshalledChildMessage msg, Marshaller marsh, GridKernalContext kctx) throws IgniteCheckedException {
+ Marshaller jdkMarsh = kctx.marshallerContext().jdkMarshaller();
+
+ if (msg.nioMsg != null)
+ MessageMarshalling.unmarshal(msg.nioMsg, jdkMarsh, kctx);
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java b/modules/core/src/test/resources/codegen/TestJdkMarshalledMessage.java
similarity index 66%
copy from modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
copy to modules/core/src/test/resources/codegen/TestJdkMarshalledMessage.java
index e1d033df696..6b14cc48e6e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/EventsDataBagItem.java
+++ b/modules/core/src/test/resources/codegen/TestJdkMarshalledMessage.java
@@ -15,24 +15,26 @@
* limitations under the License.
*/
-package org.apache.ignite.internal.managers.eventstorage;
+package org.apache.ignite.internal;
-import org.apache.ignite.internal.Order;
-import org.apache.ignite.internal.UseBinaryMarshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
-/** */
-@UseBinaryMarshaller
-public class EventsDataBagItem implements Message {
- /** */
+@JdkMarshalled
+public class TestJdkMarshalledMessage implements Message {
+ @Marshalled("dataBytes")
+ Object data;
+
@Order(0)
- int[] enabledEvts;
+ byte[] dataBytes;
+
+ @Order(1)
+ Message nested;
- /** */
- public EventsDataBagItem() { }
+ @Order(2)
+ @NioField
+ Message nioMsg;
- /** @param enabledEvts Enabled events. */
- public EventsDataBagItem(int[] enabledEvts) {
- this.enabledEvts = enabledEvts;
+ public short directType() {
+ return 0;
}
}
diff --git a/modules/core/src/test/resources/codegen/TestJdkMarshalledMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestJdkMarshalledMessageMarshaller.java
new file mode 100644
index 00000000000..16ec5fea112
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestJdkMarshalledMessageMarshaller.java
@@ -0,0 +1,74 @@
+/*
+ * 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;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.TestJdkMarshalledMessage;
+import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
+
+/**
+ * This class is generated automatically.
+ *
+ * @see org.apache.ignite.internal.MessageProcessor
+ */
+public final class TestJdkMarshalledMessageMarshaller implements MessageMarshaller<TestJdkMarshalledMessage> {
+ /** */
+ @Override public void marshal(TestJdkMarshalledMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ Marshaller jdkMarsh = kctx.marshallerContext().jdkMarshaller();
+
+ CacheObjectContext ctx = cacheObjCtx;
+
+ if (msg.data != null && msg.dataBytes == null)
+ msg.dataBytes = U.marshal(jdkMarsh, msg.data);
+
+ if (msg.nested != null)
+ MessageMarshalling.marshal(msg.nested, jdkMarsh, kctx, ctx);
+
+ if (msg.nioMsg != null)
+ MessageMarshalling.marshal(msg.nioMsg, jdkMarsh, kctx, ctx);
+ }
+
+ /** */
+ @Override public void unmarshal(TestJdkMarshalledMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ Marshaller jdkMarsh = kctx.marshallerContext().jdkMarshaller();
+
+ CacheObjectContext ctx = cacheObjCtx;
+
+ if (msg.nested != null)
+ MessageMarshalling.unmarshal(msg.nested, jdkMarsh, kctx, ctx, clsLdr);
+
+ if (msg.dataBytes != null) {
+ msg.data = U.unmarshal(jdkMarsh, msg.dataBytes, clsLdr);
+
+ msg.dataBytes = null;
+ }
+ }
+
+ /** */
+ @Override public void unmarshalNio(TestJdkMarshalledMessage msg, Marshaller marsh, GridKernalContext kctx) throws IgniteCheckedException {
+ Marshaller jdkMarsh = kctx.marshallerContext().jdkMarshaller();
+
+ if (msg.nioMsg != null)
+ MessageMarshalling.unmarshal(msg.nioMsg, jdkMarsh, kctx);
+ }
+}
diff --git a/modules/core/src/test/resources/codegen/TestMapMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMapMessageMarshaller.java
index 19927eff321..e0957b09d3a 100644
--- a/modules/core/src/test/resources/codegen/TestMapMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMapMessageMarshaller.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.TestMapMessage;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -35,7 +36,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMapMessageMarshaller implements MessageMarshaller<TestMapMessage> {
/** */
- @Override public void marshal(TestMapMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMapMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.gridCacheObjectMap != null) {
@@ -59,7 +60,7 @@ public final class TestMapMessageMarshaller implements MessageMarshaller<TestMap
}
/** */
- @Override public void unmarshal(TestMapMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMapMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.gridCacheObjectMap != null) {
diff --git a/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshaller.java
index 689ecaa39d4..75b731df58d 100644
--- a/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMarshallableMessageMarshaller.java
@@ -31,20 +31,12 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMarshallableMessageMarshaller implements MessageMarshaller<TestMarshallableMessage> {
/** */
- private final Marshaller marshaller;
-
- /** */
- public TestMarshallableMessageMarshaller(Marshaller marshaller) {
- this.marshaller = marshaller;
- }
-
- /** */
- @Override public void marshal(TestMarshallableMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
- msg.marshal(marshaller);
+ @Override public void marshal(TestMarshallableMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ msg.marshal(marsh);
}
/** */
- @Override public void unmarshal(TestMarshallableMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
- msg.unmarshal(marshaller, clsLdr);
+ @Override public void unmarshal(TestMarshallableMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ msg.unmarshal(marsh, clsLdr);
}
}
\ No newline at end of file
diff --git a/modules/core/src/test/resources/codegen/TestMarshalledArrayMapMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMarshalledArrayMapMessageMarshaller.java
index 529c2e22bdd..f2c7eb2bd95 100644
--- a/modules/core/src/test/resources/codegen/TestMarshalledArrayMapMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMarshalledArrayMapMessageMarshaller.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.managers.communication.IgniteMessageFactory;
import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -37,7 +38,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMarshalledArrayMapMessageMarshaller implements MessageMarshaller<TestMarshalledArrayMapMessage> {
/** */
- @Override public void marshal(TestMarshalledArrayMapMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMarshalledArrayMapMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
IgniteMessageFactory msgFactory = (IgniteMessageFactory)kctx.messageFactory();
CacheObjectContext ctx = cacheObjCtx;
@@ -67,7 +68,7 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
if (msg.mapKeys != null) {
for (GridTopicMessage e : msg.mapKeys) {
if (e != null)
- MessageMarshalling.marshal(msgFactory, e, kctx, ctx);
+ MessageMarshalling.marshal(msgFactory, e, marsh, kctx, ctx);
}
}
@@ -76,7 +77,7 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
if (e != null) {
for (GridTopicMessage e1 : (Collection<? extends GridTopicMessage>)e) {
if (e1 != null)
- MessageMarshalling.marshal(msgFactory, e1, kctx, ctx);
+ MessageMarshalling.marshal(msgFactory, e1, marsh, kctx, ctx);
}
}
}
@@ -85,7 +86,7 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
if (msg.fixedMapKeys != null) {
for (GridTopicMessage e : msg.fixedMapKeys) {
if (e != null)
- MessageMarshalling.marshal(msgFactory, e, kctx, ctx);
+ MessageMarshalling.marshal(msgFactory, e, marsh, kctx, ctx);
}
}
@@ -94,7 +95,7 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
if (e != null) {
for (GridTopicMessage e1 : (Collection<? extends GridTopicMessage>)e) {
if (e1 != null)
- MessageMarshalling.marshal(msgFactory, e1, kctx, ctx);
+ MessageMarshalling.marshal(msgFactory, e1, marsh, kctx, ctx);
}
}
}
@@ -102,7 +103,7 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
}
/** */
- @Override public void unmarshal(TestMarshalledArrayMapMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMarshalledArrayMapMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
IgniteMessageFactory msgFactory = (IgniteMessageFactory)kctx.messageFactory();
CacheObjectContext ctx = cacheObjCtx;
@@ -115,12 +116,12 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
List v = msg.mapVals[i];
if (k != null)
- MessageMarshalling.unmarshal(k, kctx, ctx, clsLdr);
+ MessageMarshalling.unmarshal(k, marsh, kctx, ctx, clsLdr);
if (v != null) {
for (GridTopicMessage e : (Collection<? extends GridTopicMessage>)v) {
if (e != null)
- MessageMarshalling.unmarshal(msgFactory, e, kctx, ctx, clsLdr);
+ MessageMarshalling.unmarshal(msgFactory, e, marsh, kctx, ctx, clsLdr);
}
}
@@ -137,12 +138,12 @@ public final class TestMarshalledArrayMapMessageMarshaller implements MessageMar
List v = msg.fixedMapVals[i];
if (k != null)
- MessageMarshalling.unmarshal(k, kctx, ctx, clsLdr);
+ MessageMarshalling.unmarshal(k, marsh, kctx, ctx, clsLdr);
if (v != null) {
for (GridTopicMessage e : (Collection<? extends GridTopicMessage>)v) {
if (e != null)
- MessageMarshalling.unmarshal(msgFactory, e, kctx, ctx, clsLdr);
+ MessageMarshalling.unmarshal(msgFactory, e, marsh, kctx, ctx, clsLdr);
}
}
diff --git a/modules/core/src/test/resources/codegen/TestMarshalledCollectionMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMarshalledCollectionMessageMarshaller.java
index ac0e941aba6..83f72c960e6 100644
--- a/modules/core/src/test/resources/codegen/TestMarshalledCollectionMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMarshalledCollectionMessageMarshaller.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.TestMarshalledCollectionMessage;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -32,13 +33,13 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMarshalledCollectionMessageMarshaller implements MessageMarshaller<TestMarshalledCollectionMessage> {
/** */
- @Override public void marshal(TestMarshalledCollectionMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMarshalledCollectionMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
if (msg.keys != null && msg.keysArr == null)
msg.keysArr = msg.keys.toArray(new GridCacheVersion[0]);
}
/** */
- @Override public void unmarshal(TestMarshalledCollectionMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMarshalledCollectionMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.keysArr != null) {
diff --git a/modules/core/src/test/resources/codegen/TestMarshalledMapMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMarshalledMapMessageMarshaller.java
index a2f346a8f89..dd35dfe2c6a 100644
--- a/modules/core/src/test/resources/codegen/TestMarshalledMapMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMarshalledMapMessageMarshaller.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.TestMarshalledMapMessage;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -33,7 +34,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMarshalledMapMessageMarshaller implements MessageMarshaller<TestMarshalledMapMessage> {
/** */
- @Override public void marshal(TestMarshalledMapMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMarshalledMapMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
if (msg.theMap != null && msg.mapKeys == null) {
msg.mapKeys = msg.theMap.keySet();
msg.mapVals = msg.theMap.values();
@@ -41,7 +42,7 @@ public final class TestMarshalledMapMessageMarshaller implements MessageMarshall
}
/** */
- @Override public void unmarshal(TestMarshalledMapMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMarshalledMapMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.mapKeys != null) {
diff --git a/modules/core/src/test/resources/codegen/TestMarshalledMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMarshalledMessageMarshaller.java
index 77cc8daa382..9cb6f81f26a 100644
--- a/modules/core/src/test/resources/codegen/TestMarshalledMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMarshalledMessageMarshaller.java
@@ -32,23 +32,15 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMarshalledMessageMarshaller implements MessageMarshaller<TestMarshalledMessage> {
/** */
- private final Marshaller marshaller;
-
- /** */
- public TestMarshalledMessageMarshaller(Marshaller marshaller) {
- this.marshaller = marshaller;
- }
-
- /** */
- @Override public void marshal(TestMarshalledMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMarshalledMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
if (msg.data != null && msg.dataBytes == null)
- msg.dataBytes = U.marshal(marshaller, msg.data);
+ msg.dataBytes = U.marshal(marsh, msg.data);
}
/** */
- @Override public void unmarshal(TestMarshalledMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMarshalledMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
if (msg.dataBytes != null) {
- msg.data = U.unmarshal(marshaller, msg.dataBytes, clsLdr);
+ msg.data = U.unmarshal(marsh, msg.dataBytes, clsLdr);
msg.dataBytes = null;
}
diff --git a/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessageMarshaller.java
index 5ebabc94f61..a33b14f0eff 100644
--- a/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessageMarshaller.java
@@ -35,32 +35,24 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMarshalledObjectsMessageMarshaller implements MessageMarshaller<TestMarshalledObjectsMessage> {
/** */
- private final Marshaller marshaller;
-
- /** */
- public TestMarshalledObjectsMessageMarshaller(Marshaller marshaller) {
- this.marshaller = marshaller;
- }
-
- /** */
- @Override public void marshal(TestMarshalledObjectsMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMarshalledObjectsMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
if (msg.data != null && msg.dataBytes == null) {
msg.dataBytes = new ArrayList<>(msg.data.size());
for (Object e : msg.data)
- msg.dataBytes.add(U.marshal(marshaller, e));
+ msg.dataBytes.add(U.marshal(marsh, e));
}
}
/** */
- @Override public void unmarshal(TestMarshalledObjectsMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMarshalledObjectsMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.dataBytes != null) {
msg.data = new ArrayList<>(msg.dataBytes.size());
for (byte[] e : msg.dataBytes) {
- Object o = U.unmarshal(marshaller, e, clsLdr);
+ Object o = U.unmarshal(marsh, e, clsLdr);
if (o instanceof Map.Entry) {
Object key = ((Map.Entry<?, ?>)o).getKey();
diff --git a/modules/core/src/test/resources/codegen/TestMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestMessageMarshaller.java
index 7402ff749fc..21ab7401685 100644
--- a/modules/core/src/test/resources/codegen/TestMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestMessageMarshaller.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.TestMessage;
import org.apache.ignite.internal.managers.communication.MessageMarshalling;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -31,7 +32,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestMessageMarshaller implements MessageMarshaller<TestMessage> {
/** */
- @Override public void marshal(TestMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.keyCacheObject != null && ctx != null)
@@ -41,11 +42,11 @@ public final class TestMessageMarshaller implements MessageMarshaller<TestMessag
msg.cacheObject.marshal(ctx);
if (msg.nioMsg != null)
- MessageMarshalling.marshal(msg.nioMsg, kctx, ctx);
+ MessageMarshalling.marshal(msg.nioMsg, marsh, kctx, ctx);
}
/** */
- @Override public void unmarshal(TestMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
CacheObjectContext ctx = cacheObjCtx;
if (msg.keyCacheObject != null && ctx != null)
@@ -56,8 +57,8 @@ public final class TestMessageMarshaller implements MessageMarshaller<TestMessag
}
/** */
- @Override public void unmarshalNio(TestMessage msg, GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void unmarshalNio(TestMessage msg, Marshaller marsh, GridKernalContext kctx) throws IgniteCheckedException {
if (msg.nioMsg != null)
- MessageMarshalling.unmarshal(msg.nioMsg, kctx);
+ MessageMarshalling.unmarshal(msg.nioMsg, marsh, kctx);
}
}
\ No newline at end of file
diff --git a/modules/core/src/test/resources/codegen/TestSelfMarshallingMessageMarshaller.java b/modules/core/src/test/resources/codegen/TestSelfMarshallingMessageMarshaller.java
index bbecc98571e..9f72a64eeea 100644
--- a/modules/core/src/test/resources/codegen/TestSelfMarshallingMessageMarshaller.java
+++ b/modules/core/src/test/resources/codegen/TestSelfMarshallingMessageMarshaller.java
@@ -21,6 +21,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.TestSelfMarshallingMessage;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
/**
@@ -30,12 +31,12 @@ import org.apache.ignite.plugin.extensions.communication.MessageMarshaller;
*/
public final class TestSelfMarshallingMessageMarshaller implements MessageMarshaller<TestSelfMarshallingMessage> {
/** */
- @Override public void marshal(TestSelfMarshallingMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
+ @Override public void marshal(TestSelfMarshallingMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
msg.selfMarshal();
}
/** */
- @Override public void unmarshal(TestSelfMarshallingMessage msg, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
+ @Override public void unmarshal(TestSelfMarshallingMessage msg, Marshaller marsh, GridKernalContext kctx, CacheObjectContext cacheObjCtx, ClassLoader clsLdr) throws IgniteCheckedException {
msg.selfUnmarshal();
}
-}
+}
\ No newline at end of file
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 bcc10b0bbb0..aeb7c1be885 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
@@ -29,7 +29,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.direct.DirectMessageReader;
import org.apache.ignite.internal.direct.DirectMessageWriter;
-import org.apache.ignite.internal.managers.communication.MessageMarshalling;
+import org.apache.ignite.internal.managers.communication.DiscoveryMarshalling;
import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.internal.util.nio.MessageSerialization;
import org.apache.ignite.plugin.extensions.communication.Message;
@@ -94,7 +94,7 @@ public class DiscoveryMessageParser {
msgWriter.setBuffer(msgBuf);
try {
- MessageMarshalling.marshal(m, kctx, null);
+ DiscoveryMarshalling.marshal(m, kctx, null);
}
catch (IgniteCheckedException e) {
throw new IgniteSpiException("Failed to marshal discovery message", e);
@@ -141,7 +141,7 @@ public class DiscoveryMessageParser {
while (!finished);
try {
- MessageMarshalling.unmarshal(msg, kctx);
+ DiscoveryMarshalling.unmarshal(msg, kctx);
}
catch (IgniteCheckedException e) {
throw new IgniteSpiException("Failed to unmarshal discovery message", e);