vldpyatkov commented on a change in pull request #8113:
URL: https://github.com/apache/ignite/pull/8113#discussion_r466494208



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
##########
@@ -174,10 +174,40 @@ public BinaryEnumObjectImpl(BinaryContext ctx, byte[] 
arr) {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T deserialize() throws BinaryObjectException {
-        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, 
ctx.configuration().getClassLoader(), false);
+    @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws 
BinaryObjectException {
+        ClassLoader resolveLdr = ldr == null ? 
ctx.configuration().getClassLoader() : ldr;
+
+        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, resolveLdr, 
false);
+
+        return (T)(ldr == null ? BinaryEnumCache.get(cls, ord) : 
uncachedValue(cls));
+    }
+
+    /**
+     * Get value for the given class without any caching.

Review comment:
       Add a description of parameter ord.

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
##########
@@ -740,7 +768,7 @@ void write(OptimizedObjectOutputStream out, Object obj) 
throws IOException {
 
             case OBJ_ARR:
                 OptimizedClassDescriptor compDesc = 
OptimizedMarshallerUtils.classDescriptor(clsMap,
-                    obj.getClass().getComponentType(),
+                    obj.getClass().getComponentType(), true,

Review comment:
       Add a new line before useCache flag.

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
##########
@@ -629,6 +629,16 @@ else if (fieldOffsetLen == BinaryUtils.OFFSET_2)
         return reader(null, false).findFieldByName(fieldName);
     }
 
+    /** {@inheritDoc} */
+    @Nullable @Override public <T> T deserialize(@Nullable ClassLoader ldr) 
throws BinaryObjectException {
+        if (ldr == null)
+            return deserialize();
+
+        GridBinaryMarshaller.USE_CACHE.set(Boolean.FALSE);

Review comment:
       Same as above it has to change to true in finaly block.

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
##########
@@ -174,10 +174,40 @@ public BinaryEnumObjectImpl(BinaryContext ctx, byte[] 
arr) {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T deserialize() throws BinaryObjectException {
-        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, 
ctx.configuration().getClassLoader(), false);
+    @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws 
BinaryObjectException {
+        ClassLoader resolveLdr = ldr == null ? 
ctx.configuration().getClassLoader() : ldr;
+
+        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, resolveLdr, 
false);
+
+        return (T)(ldr == null ? BinaryEnumCache.get(cls, ord) : 
uncachedValue(cls));
+    }
+
+    /**
+     * Get value for the given class without any caching.
+     *
+     * @param cls Class.
+     */
+    private <T> T uncachedValue(Class<?> cls) throws BinaryObjectException {
+        assert cls != null;
 
-        return (T)BinaryEnumCache.get(cls, ord);
+        GridBinaryMarshaller.USE_CACHE.set(Boolean.FALSE);

Review comment:
       How does it return to true?

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshaller.java
##########
@@ -100,9 +100,14 @@
     /** Class descriptors by class. */
     private final ConcurrentMap<Class, OptimizedClassDescriptor> clsMap = new 
ConcurrentHashMap<>();
 
+    /** Node name. */
+    private volatile String nodeName = U.LOC_IGNITE_NAME_EMPTY;

Review comment:
       Why do you need to lay the constant field to volatile field?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to