From 5f0196a345fcb51a6a0c90e9167f6045124aa86b Mon Sep 17 00:00:00 2001 From: Mikhail Petrov Date: Sun, 31 Mar 2024 14:43:12 +0300 Subject: [PATCH] wip --- .../internal/binary/GridBinaryMarshaller.java | 2 +- .../internal/client/thin/ClientUtils.java | 24 +++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java index 86aaaa40059146..419acbfd46d2a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java @@ -319,7 +319,7 @@ public byte[] marshal(@Nullable Object obj, boolean failIfUnregistered) throws B BinaryContext oldCtx = pushContext(ctx); try { - return (T)new BinaryReaderExImpl(ctx, in, ldr, hnds, true).deserialize(); + return (T)new BinaryReaderExImpl(ctx, in, ldr, null, true).deserialize(); } finally { popContext(oldCtx); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java index 5ea58fb5405b2f..d333d6ad80203f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java @@ -573,16 +573,14 @@ T readObject(BinaryInputStream in, boolean keepBinary, Class clazz) { if (keepBinary) return (T)marsh.unmarshal(in); else { - BinaryReaderHandles hnds = new BinaryReaderHandles(); - - return (T)unwrapBinary(marsh.deserialize(in, hnds), hnds, clazz); + return (T)unwrapBinary(marsh.deserialize(in, new BinaryReaderHandles()), clazz); } } /** * Unwrap binary object. */ - private Object unwrapBinary(Object obj, BinaryReaderHandles hnds, Class clazz) { + private Object unwrapBinary(Object obj, Class clazz) { if (obj instanceof BinaryObjectImpl) { BinaryObjectImpl obj0 = (BinaryObjectImpl)obj; @@ -591,11 +589,11 @@ private Object unwrapBinary(Object obj, BinaryReaderHandles hnds, Class clazz else if (obj instanceof BinaryObject) return ((BinaryObject)obj).deserialize(); else if (BinaryUtils.knownCollection(obj)) - return unwrapCollection((Collection)obj, hnds); + return unwrapCollection((Collection)obj); else if (BinaryUtils.knownMap(obj)) - return unwrapMap((Map)obj, hnds); + return unwrapMap((Map)obj); else if (obj instanceof Object[]) - return unwrapArray((Object[])obj, hnds, clazz); + return unwrapArray((Object[])obj, clazz); else return obj; } @@ -603,11 +601,11 @@ else if (obj instanceof Object[]) /** * Unwrap collection with binary objects. */ - private Collection unwrapCollection(Collection col, BinaryReaderHandles hnds) { + private Collection unwrapCollection(Collection col) { Collection col0 = BinaryUtils.newKnownCollection(col); for (Object obj0 : col) - col0.add(unwrapBinary(obj0, hnds, null)); + col0.add(unwrapBinary(obj0, null)); return (col0 instanceof MutableSingletonList) ? U.convertToSingletonList(col0) : col0; } @@ -615,11 +613,11 @@ private Collection unwrapCollection(Collection col, BinaryReader /** * Unwrap map with binary objects. */ - private Map unwrapMap(Map map, BinaryReaderHandles hnds) { + private Map unwrapMap(Map map) { Map map0 = BinaryUtils.newMap(map); for (Map.Entry e : map.entrySet()) - map0.put(unwrapBinary(e.getKey(), hnds, null), unwrapBinary(e.getValue(), hnds, null)); + map0.put(unwrapBinary(e.getKey(), null), unwrapBinary(e.getValue(), null)); return map0; } @@ -627,7 +625,7 @@ private Map unwrapMap(Map map, BinaryReaderHandl /** * Unwrap array with binary objects. */ - private Object[] unwrapArray(Object[] arr, BinaryReaderHandles hnds, Class arrayClass) { + private Object[] unwrapArray(Object[] arr, Class arrayClass) { if (BinaryUtils.knownArray(arr)) return arr; @@ -638,7 +636,7 @@ private Object[] unwrapArray(Object[] arr, BinaryReaderHandles hnds, Class ar Object[] res = (Object[])Array.newInstance(componentType, arr.length); for (int i = 0; i < arr.length; i++) - res[i] = unwrapBinary(arr[i], hnds, null); + res[i] = unwrapBinary(arr[i], null); return res; }