IGNITE-2099: Removed entries handling.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d53472e5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d53472e5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d53472e5 Branch: refs/heads/ignite-2099 Commit: d53472e5de989c994cd534e21ce10d54db4cd277 Parents: 75d5874 Author: vozerov-gridgain <[email protected]> Authored: Wed Dec 9 13:11:42 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Wed Dec 9 13:11:42 2015 +0300 ---------------------------------------------------------------------- .../internal/portable/BinaryFieldAccessor.java | 19 ++---- .../internal/portable/BinaryReaderExImpl.java | 24 ------- .../internal/portable/BinaryWriteMode.java | 3 - .../internal/portable/BinaryWriterExImpl.java | 45 +++---------- .../portable/GridPortableMarshaller.java | 3 - .../portable/PortableClassDescriptor.java | 6 -- .../ignite/internal/portable/PortableUtils.java | 30 --------- .../portable/builder/PortableBuilderReader.java | 10 --- .../portable/builder/PortableLazyMapEntry.java | 68 -------------------- 9 files changed, 15 insertions(+), 193 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldAccessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldAccessor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldAccessor.java index 2f6b73c..7701fb5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldAccessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldAccessor.java @@ -17,6 +17,11 @@ package org.apache.ignite.internal.portable; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.internal.util.GridUnsafe; +import org.apache.ignite.internal.util.typedef.internal.U; +import sun.misc.Unsafe; + import java.lang.reflect.Field; import java.math.BigDecimal; import java.sql.Timestamp; @@ -24,10 +29,6 @@ import java.util.Collection; import java.util.Date; import java.util.Map; import java.util.UUID; -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.internal.util.GridUnsafe; -import org.apache.ignite.internal.util.typedef.internal.U; -import sun.misc.Unsafe; /** * Field accessor to speedup access. @@ -607,11 +608,6 @@ public abstract class BinaryFieldAccessor { break; - case MAP_ENTRY: - writer.writeMapEntryField((Map.Entry<?, ?>)val); - - break; - case PORTABLE_OBJ: writer.writePortableObjectField((BinaryObjectImpl)val); @@ -813,11 +809,6 @@ public abstract class BinaryFieldAccessor { break; - case MAP_ENTRY: - val = reader.readMapEntry(id); - - break; - case PORTABLE_OBJ: val = reader.readPortableObject(id); http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java index e2d098b..6a8091f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java @@ -65,7 +65,6 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT_ARR import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG; import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG_ARR; import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP; -import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENTRY; import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL; import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ; import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR; @@ -313,24 +312,6 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina /** * @param fieldId Field ID. - * @return Value. - * @throws BinaryObjectException On case of error. - */ - @Nullable Map.Entry<?, ?> readMapEntry(int fieldId) throws BinaryObjectException { - if (findFieldById(fieldId)) { - Flag flag = checkFlag(MAP_ENTRY); - - if (flag == Flag.NORMAL) - return PortableUtils.doReadMapEntry(in, ctx, ldr, this, true); - else if (flag == Flag.HANDLE) - return readHandleField(); - } - - return null; - } - - /** - * @param fieldId Field ID. * @return Portable object. * @throws BinaryObjectException In case of error. */ @@ -1617,11 +1598,6 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina break; - case MAP_ENTRY: - obj = PortableUtils.doReadMapEntry(in, ctx, ldr, this, true); - - break; - case PORTABLE_OBJ: obj = PortableUtils.doReadPortableObject(in, ctx); http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java index bd73ad0..3e0bf69 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java @@ -133,9 +133,6 @@ public enum BinaryWriteMode { MAP(GridPortableMarshaller.MAP), /** */ - MAP_ENTRY(GridPortableMarshaller.MAP_ENTRY), - - /** */ PORTABLE_OBJ(GridPortableMarshaller.OBJ), /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java index 6bb493e..4139b8f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java @@ -17,6 +17,16 @@ package org.apache.ignite.internal.portable; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.binary.BinaryIdMapper; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.BinaryRawWriter; +import org.apache.ignite.binary.BinaryWriter; +import org.apache.ignite.internal.portable.streams.PortableHeapOutputStream; +import org.apache.ignite.internal.portable.streams.PortableOutputStream; +import org.apache.ignite.internal.util.typedef.internal.A; +import org.jetbrains.annotations.Nullable; + import java.io.IOException; import java.io.ObjectOutput; import java.lang.reflect.InvocationTargetException; @@ -27,15 +37,6 @@ import java.util.Collection; import java.util.Date; import java.util.Map; import java.util.UUID; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.binary.BinaryIdMapper; -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.binary.BinaryRawWriter; -import org.apache.ignite.binary.BinaryWriter; -import org.apache.ignite.internal.portable.streams.PortableHeapOutputStream; -import org.apache.ignite.internal.portable.streams.PortableOutputStream; -import org.apache.ignite.internal.util.typedef.internal.A; -import org.jetbrains.annotations.Nullable; import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.ignite.internal.portable.GridPortableMarshaller.BOOLEAN; @@ -62,7 +63,6 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT_ARR import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG; import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG_ARR; import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP; -import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENTRY; import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL; import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ; import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR; @@ -761,23 +761,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje } /** - * @param e Map entry. - * @throws org.apache.ignite.binary.BinaryObjectException In case of error. - */ - void doWriteMapEntry(@Nullable Map.Entry<?, ?> e) throws BinaryObjectException { - if (e == null) - out.writeByte(NULL); - else { - if (tryWriteAsHandle(e)) - return; - - out.writeByte(MAP_ENTRY); - doWriteObject(e.getKey()); - doWriteObject(e.getValue()); - } - } - - /** * @param val Value. */ void doWriteEnum(@Nullable Enum<?> val) { @@ -1218,14 +1201,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje } /** - * @param e Map entry. - * @throws org.apache.ignite.binary.BinaryObjectException In case of error. - */ - void writeMapEntryField(@Nullable Map.Entry<?, ?> e) throws BinaryObjectException { - doWriteMapEntry(e); - } - - /** * @param val Value. */ void writeEnumField(@Nullable Enum<?> val) { http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java index a9df27d..5063a1e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java @@ -119,9 +119,6 @@ public class GridPortableMarshaller { public static final byte MAP = 25; /** */ - public static final byte MAP_ENTRY = 26; - - /** */ public static final byte PORTABLE_OBJ = 27; /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java index 984f7c9..620b16a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java @@ -206,7 +206,6 @@ public class PortableClassDescriptor { case OBJECT_ARR: case COL: case MAP: - case MAP_ENTRY: case PORTABLE_OBJ: case ENUM: case PORTABLE_ENUM: @@ -537,11 +536,6 @@ public class PortableClassDescriptor { break; - case MAP_ENTRY: - writer.doWriteMapEntry((Map.Entry<?, ?>)obj); - - break; - case ENUM: writer.doWriteEnum((Enum<?>)obj); http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java index 62d2e9a..e4ae77c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java @@ -26,7 +26,6 @@ import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.binary.Binarylizable; import org.apache.ignite.internal.portable.builder.PortableLazyValue; import org.apache.ignite.internal.portable.streams.PortableInputStream; -import org.apache.ignite.internal.util.lang.GridMapEntry; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiTuple; @@ -87,7 +86,6 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.LINKED_ import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG; import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG_ARR; import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP; -import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENTRY; import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL; import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ; import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJECT_TYPE_ID; @@ -263,7 +261,6 @@ public class PortableUtils { FIELD_TYPE_NAMES[PORTABLE_OBJ] = "Object"; FIELD_TYPE_NAMES[COL] = "Collection"; FIELD_TYPE_NAMES[MAP] = "Map"; - FIELD_TYPE_NAMES[MAP_ENTRY] = "Entry"; FIELD_TYPE_NAMES[CLASS] = "Class"; FIELD_TYPE_NAMES[BYTE_ARR] = "byte[]"; FIELD_TYPE_NAMES[SHORT_ARR] = "short[]"; @@ -618,9 +615,6 @@ public class PortableUtils { if (Map.class.isAssignableFrom(cls)) return MAP; - if (Map.Entry.class.isAssignableFrom(cls)) - return MAP_ENTRY; - return OBJ; } @@ -1003,8 +997,6 @@ public class PortableUtils { return BinaryWriteMode.PORTABLE; else if (Externalizable.class.isAssignableFrom(cls)) return BinaryWriteMode.EXTERNALIZABLE; - else if (Map.Entry.class.isAssignableFrom(cls)) - return BinaryWriteMode.MAP_ENTRY; else if (isSpecialCollection(cls)) return BinaryWriteMode.COL; else if (isSpecialMap(cls)) @@ -1700,9 +1692,6 @@ public class PortableUtils { case MAP: return doReadMap(in, ctx, ldr, handles, false, null); - case MAP_ENTRY: - return doReadMapEntry(in, ctx, ldr, handles, false); - case PORTABLE_OBJ: return doReadPortableObject(in, ctx); @@ -1872,25 +1861,6 @@ public class PortableUtils { } /** - * @param deserialize Deserialize flag flag. - * @return Value. - * @throws BinaryObjectException In case of error. - */ - public static Map.Entry<?, ?> doReadMapEntry(PortableInputStream in, PortableContext ctx, ClassLoader ldr, - BinaryReaderHandlesHolder handles, boolean deserialize) throws BinaryObjectException { - int hPos = positionForHandle(in); - - Object val1 = deserializeOrUnmarshal(in, ctx, ldr, handles, deserialize); - Object val2 = deserializeOrUnmarshal(in, ctx, ldr, handles, deserialize); - - GridMapEntry entry = new GridMapEntry<>(val1, val2); - - handles.setHandle(entry, hPos); - - return entry; - } - - /** * Deserialize or unmarshal the object. * * @param deserialize Deserialize. http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java index 1e6ef91..29840eb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java @@ -344,12 +344,6 @@ public class PortableBuilderReader implements PortablePositionReadable { return; } - case GridPortableMarshaller.MAP_ENTRY: - skipValue(); - skipValue(); - - return; - case GridPortableMarshaller.PORTABLE_OBJ: len = readInt() + 4; @@ -448,7 +442,6 @@ public class PortableBuilderReader implements PortablePositionReadable { case GridPortableMarshaller.OBJ_ARR: case GridPortableMarshaller.COL: case GridPortableMarshaller.MAP: - case GridPortableMarshaller.MAP_ENTRY: return new LazyCollection(pos); case GridPortableMarshaller.ENUM: { @@ -746,9 +739,6 @@ public class PortableBuilderReader implements PortablePositionReadable { case GridPortableMarshaller.ENUM_ARR: return new PortableEnumArrayLazyValue(this); - case GridPortableMarshaller.MAP_ENTRY: - return new PortableLazyMapEntry(this); - case GridPortableMarshaller.PORTABLE_OBJ: { int size = readInt(); http://git-wip-us.apache.org/repos/asf/ignite/blob/d53472e5/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java deleted file mode 100644 index 5ebb223..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.portable.builder; - -import org.apache.ignite.internal.portable.*; - -import java.util.Map; - -/** - * - */ -class PortableLazyMapEntry implements Map.Entry<Object, Object>, PortableBuilderSerializationAware { - /** */ - private final Object key; - - /** */ - private Object val; - - /** - * @param reader GridMutablePortableReader - */ - PortableLazyMapEntry(PortableBuilderReader reader) { - key = reader.parseValue(); - val = reader.parseValue(); - } - - /** {@inheritDoc} */ - @Override public Object getKey() { - return PortableUtils.unwrapLazy(key); - } - - /** {@inheritDoc} */ - @Override public Object getValue() { - return PortableUtils.unwrapLazy(val); - } - - /** {@inheritDoc} */ - @Override public Object setValue(Object val) { - Object res = getValue(); - - this.val = val; - - return res; - } - - /** {@inheritDoc} */ - @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) { - writer.writeByte(GridPortableMarshaller.MAP_ENTRY); - - ctx.writeValue(writer, key); - ctx.writeValue(writer, val); - } -}
