This is an automated email from the ASF dual-hosted git repository.
av 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 cc8c96f396d IGNITE-28220 : Revise serialization of
GridDeploymentRequest v2 (#12888)
cc8c96f396d is described below
commit cc8c96f396dcd9c6d9729bc9b7f807aaeb9a2f3d
Author: Vladimir Steshin <[email protected]>
AuthorDate: Mon Mar 16 19:38:18 2026 +0300
IGNITE-28220 : Revise serialization of GridDeploymentRequest v2 (#12888)
---
.../java/org/apache/ignite/internal/GridTopic.java | 20 ++++--
.../deployment/GridDeploymentCommunication.java | 24 ++-----
.../managers/deployment/GridDeploymentRequest.java | 81 +++++++++-------------
...loymentRequestOfUnknownClassProcessingTest.java | 14 ++--
4 files changed, 58 insertions(+), 81 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
index eab5c01c28c..2c9e30b09e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
@@ -177,7 +177,7 @@ public enum GridTopic {
* @param id Topic ID.
* @return Grid message topic with specified ID.
*/
- public Object topic(IgniteUuid id) {
+ public T1 topic(IgniteUuid id) {
return new T1(this, id);
}
@@ -250,10 +250,8 @@ public enum GridTopic {
return new T7(this,
UUID.nameUUIDFromBytes(id1.getBytes(DFLT_CHARSET)), id2, id3, id4);
}
- /**
- *
- */
- private static class T1 implements Externalizable {
+ /** */
+ public static class T1 implements Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -274,11 +272,21 @@ public enum GridTopic {
* @param topic Topic.
* @param id ID.
*/
- private T1(GridTopic topic, IgniteUuid id) {
+ public T1(GridTopic topic, IgniteUuid id) {
this.topic = topic;
this.id = id;
}
+ /** */
+ public GridTopic topic() {
+ return topic;
+ }
+
+ /** */
+ public IgniteUuid id() {
+ return id;
+ }
+
/** {@inheritDoc} */
@Override public int hashCode() {
return topic.ordinal() + id.hashCode();
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
index 6de75ab2089..c83d39e4bf9 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
@@ -29,6 +29,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
@@ -137,7 +138,7 @@ class GridDeploymentCommunication {
try {
GridDeploymentRequest req = (GridDeploymentRequest)msg;
- if (req.isUndeploy())
+ if (req.undeploy())
processUndeployRequest(nodeId, req);
else {
assert activeReqNodeIds.get() == null;
@@ -186,18 +187,6 @@ class GridDeploymentCommunication {
if (log.isDebugEnabled())
log.debug("Received peer class/resource loading request
[originatingNodeId=" + nodeId + ", req=" + req + ']');
- if (req.responseTopic() == null) {
- try {
- req.finishUnmarshal(marsh, U.resolveClassLoader(ctx.config()));
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to process deployment request (will
ignore) [" +
- "originatingNodeId=" + nodeId + ", req=" + req + ']', e);
-
- return;
- }
- }
-
GridDeploymentResponse res = new GridDeploymentResponse();
GridDeployment dep = ctx.deploy().getDeployment(req.classLoaderId());
@@ -361,7 +350,7 @@ class GridDeploymentCommunication {
ctx.io().sendToGridTopic(
rmtNodes,
TOPIC_CLASSLOAD,
- new GridDeploymentRequest(null, null, rsrcName, true),
+ new GridDeploymentRequest(rsrcName),
GridIoPolicy.P2P_POOL);
}
}
@@ -393,9 +382,9 @@ class GridDeploymentCommunication {
", requesters=" + nodeIds + ']');
}
- Object resTopic =
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(ctx.localNodeId()));
+ GridTopic.T1 resTopic =
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(ctx.localNodeId()));
- GridDeploymentRequest req = new GridDeploymentRequest(resTopic,
clsLdrId, rsrcName, false);
+ GridDeploymentRequest req = new GridDeploymentRequest(resTopic,
clsLdrId, rsrcName);
// Send node IDs chain with request.
req.nodeIds(nodeIds);
@@ -417,9 +406,6 @@ class GridDeploymentCommunication {
long start = U.currentTimeMillis();
- if (req.responseTopic() != null &&
!ctx.localNodeId().equals(dstNode.id()))
- req.prepareMarshal(marsh);
-
ctx.io().sendToGridTopic(dstNode, TOPIC_CLASSLOAD, req,
GridIoPolicy.P2P_POOL);
if (log.isDebugEnabled())
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
index 00890882e05..31484637bed 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
@@ -19,37 +19,34 @@ package org.apache.ignite.internal.managers.deployment;
import java.util.Collection;
import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridTopic;
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.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
-import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
/**
* Deployment request.
*/
public class GridDeploymentRequest implements Message {
/** Response topic. Response should be sent back to this topic. */
- private Object resTopic;
-
- /** Serialized topic. */
+ /** */
@Order(0)
- byte[] resTopicBytes;
+ @Nullable GridTopic topic;
- /** Requested class name. */
+ /** */
@Order(1)
- String rsrcName;
+ @Nullable IgniteUuid topicId;
- /** Class loader ID. */
+ /** Requested class name. */
@Order(2)
- IgniteUuid ldrId;
+ String rsrcName;
- /** Undeploy flag. */
+ /** Class loader ID. */
@Order(3)
- boolean isUndeploy;
+ @Nullable IgniteUuid ldrId;
/** Nodes participating in request (chain). */
@Order(4)
@@ -64,22 +61,26 @@ public class GridDeploymentRequest implements Message {
}
/**
- * Creates new request.
+ * Creates deploy request.
*
- * @param resTopic Response topic.
+ * @param topic Response topic.
* @param ldrId Class loader ID.
* @param rsrcName Resource name that should be found and sent back.
- * @param isUndeploy Undeploy property.
*/
- GridDeploymentRequest(Object resTopic, IgniteUuid ldrId, String rsrcName,
boolean isUndeploy) {
- assert isUndeploy || resTopic != null;
- assert isUndeploy || ldrId != null;
- assert rsrcName != null;
-
- this.resTopic = resTopic;
+ GridDeploymentRequest(GridTopic.T1 topic, IgniteUuid ldrId, String
rsrcName) {
+ this.topic = topic.topic();
+ topicId = topic.id();
this.ldrId = ldrId;
this.rsrcName = rsrcName;
- this.isUndeploy = isUndeploy;
+ }
+
+ /**
+ * Creates undeploy request.
+ *
+ * @param rsrcName Resource name that should be found and sent back.
+ */
+ GridDeploymentRequest(String rsrcName) {
+ this.rsrcName = rsrcName;
}
/**
@@ -87,8 +88,10 @@ public class GridDeploymentRequest implements Message {
*
* @return Response topic name.
*/
- Object responseTopic() {
- return resTopic;
+ @Nullable GridTopic.T1 responseTopic() {
+ assert topic == null && topicId == null || topic != null && topicId !=
null;
+
+ return topic == null ? null : new GridTopic.T1(topic, topicId);
}
/**
@@ -105,7 +108,7 @@ public class GridDeploymentRequest implements Message {
*
* @return Property class loader ID.
*/
- public IgniteUuid classLoaderId() {
+ public @Nullable IgniteUuid classLoaderId() {
return ldrId;
}
@@ -114,8 +117,10 @@ public class GridDeploymentRequest implements Message {
*
* @return Property undeploy.
*/
- public boolean isUndeploy() {
- return isUndeploy;
+ public boolean undeploy() {
+ assert topic == null && topicId == null || topic != null && topicId !=
null;
+
+ return topic == null;
}
/**
@@ -134,26 +139,6 @@ public class GridDeploymentRequest implements Message {
this.nodeIds = nodeIds;
}
- /**
- * @param marsh Marshaller.
- */
- public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException
{
- if (resTopic != null && resTopicBytes == null)
- resTopicBytes = U.marshal(marsh, resTopic);
- }
-
- /**
- * @param marsh Marshaller.
- * @param ldr Class loader.
- */
- public void finishUnmarshal(Marshaller marsh, ClassLoader ldr) throws
IgniteCheckedException {
- if (resTopicBytes != null && resTopic == null) {
- resTopic = U.unmarshal(marsh, resTopicBytes, ldr);
-
- resTopicBytes = null;
- }
- }
-
/** {@inheritDoc} */
@Override public short directType() {
return 11;
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
index 356e81477b3..6abf93cd8fc 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
@@ -21,10 +21,12 @@ import java.net.URL;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.testframework.GridTestExternalClassLoader;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
@@ -38,9 +40,6 @@ import static
org.apache.ignite.internal.GridTopic.TOPIC_CLASSLOAD;
* Tests the processing of deployment request with an attempt to load a class
with an unknown class name.
*/
public class DeploymentRequestOfUnknownClassProcessingTest extends
GridCommonAbstractTest {
- /** */
- private static final String TEST_TOPIC_NAME = "TEST_TOPIC_NAME";
-
/** */
private static final String UNKNOWN_CLASS_NAME =
"unknown.UnknownClassName";
@@ -100,7 +99,9 @@ public class DeploymentRequestOfUnknownClassProcessingTest
extends GridCommonAbs
remNodeLog.registerListener(remNodeLogLsnr);
- locNode.context().io().addMessageListener(TEST_TOPIC_NAME, new
GridMessageListener() {
+ GridTopic.T1 topic =
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(locNode.localNode().id()));
+
+ locNode.context().io().addMessageListener(topic, new
GridMessageListener() {
@Override public void onMessage(UUID nodeId, Object msg, byte plc)
{
try {
assertTrue(msg instanceof GridDeploymentResponse);
@@ -124,10 +125,7 @@ public class DeploymentRequestOfUnknownClassProcessingTest
extends GridCommonAbs
}
});
- GridDeploymentRequest req = new GridDeploymentRequest(TEST_TOPIC_NAME,
locDep.classLoaderId(),
- UNKNOWN_CLASS_NAME, false);
-
- req.prepareMarshal(locNode.context().marshaller());
+ GridDeploymentRequest req = new GridDeploymentRequest(topic,
locDep.classLoaderId(), UNKNOWN_CLASS_NAME);
locNode.context().io().sendToGridTopic(remNode.localNode(),
TOPIC_CLASSLOAD, req, GridIoPolicy.P2P_POOL);