You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/08/14 09:25:16 UTC

[GitHub] [ignite] vldpyatkov commented on a change in pull request #8146: IGNITE-5038 recovered 2

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshaller.java
##########
@@ -218,14 +222,29 @@ public OptimizedMarshaller setPoolSize(int poolSize) {
 
     /** {@inheritDoc} */
     @Override protected <T> T unmarshal0(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+        return unmarshal0(in, clsLdr, GridBinaryMarshaller.USE_CACHE.get());
+    }
+
+    /**
+     * Unmarshals object from the input stream using given class loader.
+     * This method should not close given input stream.
+     *
+     * @param <T> Type of unmarshalled object.
+     * @param in Input stream.
+     * @param clsLdr Class loader to use.
+     * @param useCache True if class loader cache will be used, false otherwise.
+     * @return Unmarshalled object.
+     * @throws IgniteCheckedException If unmarshalling failed.
+     */
+    protected <T> T unmarshal0(InputStream in, @Nullable ClassLoader clsLdr, boolean useCache) throws IgniteCheckedException {
         assert in != null;
 
         OptimizedObjectInputStream objIn = null;
 
         try {
-            objIn = registry.in();
+            objIn = !useCache ? nonCachedRegistry.in() : registry.in();

Review comment:
       It looks strange when you use useCache here, because after decision is made you use this flag again.
   If I were you, that I add this flag to the constructor of OptimizedObjectSharedStreamRegistry.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
##########
@@ -706,6 +722,39 @@ public BinaryClassDescriptor descriptorForTypeId(
         return desc;
     }
 
+    /**
+     * Creates descriptor without registration.
+     *
+     * @param cls Class.
+     * @return Binary class descriptor.
+     */
+    @NotNull private BinaryClassDescriptor createNoneCacheClassDescriptor(Class cls) {
+        String clsName = cls.getName();
+
+        BinaryInternalMapper mapper = userTypeMapper(clsName);
+
+        int typeId = mapper.typeId(clsName);
+
+        String typeName = mapper.typeName(clsName);
+
+        BinarySerializer serializer = serializerForClass(cls);
+
+        String affFieldName = affinityFieldName(cls);
+
+        return new BinaryClassDescriptor(this,
+            cls,
+            true,
+            typeId,
+            typeName,
+            affFieldName,
+            mapper,
+            serializer,
+            true,
+            true,
+            false

Review comment:
       I am not sure, but this parameter (exclude == false) will be able to give a side-efect in some cases, where we use excluded types.




----------------------------------------------------------------
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:
users@infra.apache.org