zstan commented on code in PR #13899:
URL: https://github.com/apache/ignite/pull/13899#discussion_r4783910614
##########
modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryImplUtils.java:
##########
@@ -369,13 +369,20 @@ public static Object doReadOptimized(BinaryInputStream
in, BinaryContext ctx, @N
ByteArrayInputStream input = new ByteArrayInputStream(in.array(),
in.position(), len);
+ BinaryMarshaller marsh = ctx.marshaller();
+ boolean bindCtx = marsh == null || !marsh.getContext().isNodeContext();
+ BinaryContext oldCtx = bindCtx ? GridBinaryMarshaller.pushContext(ctx)
: null;
+
try {
return ctx.optimizedMarsh().unmarshal(input,
CommonUtils.resolveClassLoader(clsLdr, ctx.classLoader()));
}
catch (IgniteCheckedException e) {
throw new BinaryObjectException("Failed to unmarshal object with
optimized marshaller", e);
}
finally {
+ if (bindCtx)
+ GridBinaryMarshaller.popContext(oldCtx);
Review Comment:
```suggestion
boolean emptyMarshaller = ctx.marshaller().binaryMarshaller() ==
null;
BinaryContext oldCtx = null;
if (emptyMarshaller)
oldCtx = GridBinaryMarshaller.pushContext(ctx);
try {
return ctx.optimizedMarsh().unmarshal(input,
CommonUtils.resolveClassLoader(clsLdr, ctx.classLoader()));
}
catch (IgniteCheckedException e) {
throw new BinaryObjectException("Failed to unmarshal object with
optimized marshaller", e);
}
finally {
if (emptyMarshaller)
GridBinaryMarshaller.popContext(oldCtx);
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]