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 11:33:38 UTC

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

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



##########
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:
       We need to rely on the flag explicitly here to prevent caching in `clsMap` of OptimizedObjectInputStream.
   Different logic on close() can be moved inside OptimizedObjectSharedStreamRegistry, but it doesn't look like that the code will be significantly simplified.




----------------------------------------------------------------
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