ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [18/25] ignite git commit: Revert "IGNITE-3154: Optimized BinaryField lookup within a BinaryType."
Date Fri, 01 Jul 2016 13:00:06 GMT
Revert "IGNITE-3154: Optimized BinaryField lookup within a BinaryType."

This reverts commit 62c714340ef6c40de4dcdb6d9ecaf11ab30df834.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6961e637
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6961e637
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6961e637

Branch: refs/heads/ignite-3154
Commit: 6961e6375e5587b6a0dc24c5ce16338ee6a407f8
Parents: 02d395c
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Jun 30 09:27:08 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Jun 30 09:27:08 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   1 +
 .../internal/binary/BinaryEnumObjectImpl.java   |   2 +-
 .../internal/binary/BinaryObjectImpl.java       |   5 +-
 .../binary/BinaryObjectOffheapImpl.java         |   5 +-
 .../ignite/internal/binary/BinaryTypeProxy.java | 107 -------------------
 .../ignite/internal/binary/BinaryUtils.java     |  21 +---
 6 files changed, 12 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6961e637/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 3853841..d39f9c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -83,6 +83,7 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileUnlockProcess
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
 import org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy;
+import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.lang.GridMapEntry;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6961e637/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index eea85ef9..60642ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -131,7 +131,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable,
Cac
 
     /** {@inheritDoc} */
     @Override public BinaryType type() throws BinaryObjectException {
-        return BinaryUtils.typeProxy(ctx, this);
+        return ctx.metadata(typeId());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6961e637/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index 9ebee0b..173bb6e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -227,7 +227,10 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements
Extern
 
     /** {@inheritDoc} */
     @Nullable @Override public BinaryType type() throws BinaryObjectException {
-        return BinaryUtils.typeProxy(ctx, this);
+        if (ctx == null)
+            throw new BinaryObjectException("BinaryContext is not set for the object.");
+
+        return ctx.metadata(typeId());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6961e637/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
index 60527d1..509247f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
@@ -142,7 +142,10 @@ public class BinaryObjectOffheapImpl extends BinaryObjectExImpl implements
Exter
 
     /** {@inheritDoc} */
     @Nullable @Override public BinaryType type() throws BinaryObjectException {
-        return BinaryUtils.typeProxy(ctx, this);
+        if (ctx == null)
+            throw new BinaryObjectException("BinaryContext is not set for the object.");
+
+        return ctx.metadata(typeId());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6961e637/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
deleted file mode 100644
index e10f2f7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
+++ /dev/null
@@ -1,107 +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.binary;
-
-import org.apache.ignite.binary.BinaryField;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-import java.util.Collection;
-
-/**
- * Binary type proxy. Is used to delay or completely avoid metadata lookup.
- */
-public class BinaryTypeProxy implements BinaryType {
-    /** Binary context. */
-    @GridToStringExclude
-    private final BinaryContext ctx;
-
-    /** Type ID. */
-    private final int typeId;
-
-    /** Target type. */
-    @GridToStringExclude
-    private volatile BinaryType target;
-
-    /**
-     * Constrcutor.
-     *
-     * @param ctx Context.
-     * @param typeId Type ID.
-     */
-    public BinaryTypeProxy(BinaryContext ctx, int typeId) {
-        this.ctx = ctx;
-        this.typeId = typeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int typeId() {
-        return typeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public BinaryField field(String fieldName) {
-        return ctx.createField(typeId, fieldName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String typeName() {
-        return target().typeName();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<String> fieldNames() {
-        return target().fieldNames();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String fieldTypeName(String fieldName) {
-        return target().fieldTypeName(fieldName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String affinityKeyFieldName() {
-        return target().affinityKeyFieldName();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isEnum() {
-        return target().isEnum();
-    }
-
-    /**
-     * @return Target ype.
-     */
-    private BinaryType target() {
-        if (target == null) {
-            synchronized (this) {
-                if (target == null) {
-                    target = ctx.metadata(typeId);
-                }
-            }
-        }
-
-        return target;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(BinaryTypeProxy.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6961e637/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index e986228..0250e3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -54,7 +54,6 @@ import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryType;
 import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.internal.binary.builder.BinaryLazyValue;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
@@ -603,7 +602,6 @@ public class BinaryUtils {
      * @param map Map.
      * @return New map of the same type or null.
      */
-    @SuppressWarnings("unchecked")
     public static <K, V> Map<K, V> newKnownMap(Object map) {
         Class<?> cls = map == null ? null : map.getClass();
 
@@ -678,7 +676,6 @@ public class BinaryUtils {
      * @param col Collection.
      * @return New empty collection.
      */
-    @SuppressWarnings("unchecked")
     public static <V> Collection<V> newKnownCollection(Object col) {
         Class<?> cls = col == null ? null : col.getClass();
 
@@ -1395,7 +1392,6 @@ public class BinaryUtils {
     /**
      * @return Value.
      */
-    @SuppressWarnings("ConstantConditions")
     public static Object doReadProxy(BinaryInputStream in, BinaryContext ctx, ClassLoader
ldr,
         BinaryReaderHandlesHolder handles) {
         Class<?>[] intfs = new Class<?>[in.readInt()];
@@ -2127,7 +2123,8 @@ public class BinaryUtils {
                         throw new BinaryObjectException("Malformed input around byte: " +
(off - 1));
 
                     res[charArrCnt++] = (char)(((c & 0x0F) << 12) |
-                        ((c2 & 0x3F) << 6) | (c3 & 0x3F));
+                        ((c2 & 0x3F) << 6) |
+                        ((c3 & 0x3F) << 0));
 
                     break;
                 default:
@@ -2186,20 +2183,6 @@ public class BinaryUtils {
     }
 
     /**
-     * Create binary type proxy.
-     *
-     * @param ctx Context.
-     * @param obj Binary object.
-     * @return Binary type proxy.
-     */
-    public static BinaryType typeProxy(BinaryContext ctx, BinaryObjectEx obj) {
-        if (ctx == null)
-            throw new BinaryObjectException("BinaryContext is not set for the object.");
-
-        return new BinaryTypeProxy(ctx, obj.typeId());
-    }
-
-    /**
      * Enum type.
      */
     private static class EnumType {


Mime
View raw message