This is an automated email from the ASF dual-hosted git repository.
nizhikov 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 bbd82de8f43 IGNITE-29109 Cache binarylizable system class descriptors
in registered state (#13653)
bbd82de8f43 is described below
commit bbd82de8f4333a7c7ac1f9c7e0c1c7dda5a4a134
Author: Nikolay <[email protected]>
AuthorDate: Tue Oct 6 19:43:17 2026 +0300
IGNITE-29109 Cache binarylizable system class descriptors in registered
state (#13653)
---
.../ignite/internal/binary/BinaryContext.java | 2 +-
.../binary/BinaryContextPredefinedTypesTest.java | 42 ++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 6a9a941278f..64450ca2b21 100644
---
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -615,7 +615,7 @@ public class BinaryContext {
public void registerBinarilizableSystemClass(Class<?> cls) {
String clsName = cls.getName();
- descByCls.put(cls, systemClassDescriptor(cls, clsName, new
BinaryReflectiveSerializer()));
+ descByCls.put(cls, systemClassDescriptor(cls, clsName, new
BinaryReflectiveSerializer()).makeRegistered());
}
/**
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryContextPredefinedTypesTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryContextPredefinedTypesTest.java
index a2d43ed927f..29fdd66f758 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryContextPredefinedTypesTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryContextPredefinedTypesTest.java
@@ -17,6 +17,10 @@
package org.apache.ignite.internal.binary;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
@@ -41,4 +45,42 @@ public class BinaryContextPredefinedTypesTest extends
GridCommonAbstractTest {
desc.describedClass() == desc.ctor().getDeclaringClass());
}
}
+
+ /** Tests that binarylizable system classes registered by {@link
BinaryContext} itself are cached in the registered state. */
+ @Test
+ public void testBinarilizableSystemClassesRegistered() {
+ BinaryContext ctx = U.binaryContext(null);
+
+ assertRegisteredSystemClass(ctx, TreeMap.class);
+ assertRegisteredSystemClass(ctx, TreeSet.class);
+ assertRegisteredSystemClass(ctx, BinaryTreeMap.class);
+ }
+
+ /** Tests that binarylizable system classes registered by processors on
node start are cached in the registered state. */
+ @Test
+ public void testProcessorBinarilizableSystemClassesRegistered() throws
Exception {
+ try (IgniteEx ignite = startGrid(0)) {
+ BinaryContext ctx =
ignite.context().cacheObjects().binaryContext();
+
+ assertRegisteredSystemClass(ctx, TreeMap.class);
+ assertRegisteredSystemClass(ctx, TreeSet.class);
+ assertRegisteredSystemClass(ctx, BinaryTreeMap.class);
+
+ assertRegisteredSystemClass(ctx, GridClosureProcessor.C1.class);
+ assertRegisteredSystemClass(ctx, GridClosureProcessor.C1MLA.class);
+ assertRegisteredSystemClass(ctx, GridClosureProcessor.C2.class);
+ assertRegisteredSystemClass(ctx, GridClosureProcessor.C2MLA.class);
+ assertRegisteredSystemClass(ctx, GridClosureProcessor.C4.class);
+ assertRegisteredSystemClass(ctx, GridClosureProcessor.C4MLA.class);
+ }
+ }
+
+ /** */
+ private static void assertRegisteredSystemClass(BinaryContext ctx,
Class<?> cls) {
+ BinaryClassDescriptor desc = ctx.descriptorForClass(cls);
+
+ assertFalse(cls.getName(), desc.userType());
+ assertTrue("Cached descriptor must be registered: " + cls.getName(),
desc.registered());
+ assertTrue("Write path must reuse cached descriptor: " +
cls.getName(), desc == ctx.registerClass(cls, true, false));
+ }
}