You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/11/09 09:26:12 UTC

ignite git commit: IGNITE-1753 Fixed portables logic after merge with ignite-1282.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1753-1282 ff0a5e1dd -> c176f07d9


IGNITE-1753 Fixed portables logic after merge with ignite-1282.


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

Branch: refs/heads/ignite-1753-1282
Commit: c176f07d97a66d1b539ae1a4760c395e131514a0
Parents: ff0a5e1
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Nov 9 15:26:10 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Nov 9 15:26:10 2015 +0700

----------------------------------------------------------------------
 .../cache/store/jdbc/CacheJdbcPojoStore.java    | 36 ++------------------
 1 file changed, 3 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c176f07d/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
index 607b229..c1502c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
@@ -28,7 +28,6 @@ import java.util.HashMap;
 import java.util.Map;
 import javax.cache.CacheException;
 import javax.cache.integration.CacheLoaderException;
-import org.apache.ignite.IgniteBinary;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectBuilder;
 import org.apache.ignite.cache.store.CacheStore;
@@ -46,9 +45,6 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
     /** POJO methods cache. */
     private volatile Map<String, Map<String, PojoMethodsCache>> pojosMethods = Collections.emptyMap();
 
-    /** Binary types cache. */
-    private volatile Map<String, Map<String, Integer>> binariesTypeIds = Collections.emptyMap();
-
     /**
      * Get field value from object for use as query parameter.
      *
@@ -136,7 +132,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
             case POJO:
                 return (R)buildPojoObject(cacheName, typeName, fields, loadColIdxs, rs);
             default:
-                return (R)buildBinaryObject(cacheName, typeName, fields, hashFields, loadColIdxs, rs);
+                return (R)buildBinaryObject(typeName, fields, hashFields, loadColIdxs, rs);
         }
     }
 
@@ -230,7 +226,6 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
     /**
      * Construct binary object from query result.
      *
-     * @param cacheName Cache name.
      * @param typeName Type name.
      * @param fields Fields descriptors.
      * @param hashFields Collection of fields to build hash for.
@@ -239,20 +234,10 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
      * @return Constructed binary object.
      * @throws CacheLoaderException If failed to construct binary object.
      */
-    protected Object buildBinaryObject(String cacheName, String typeName, JdbcTypeField[] fields,
+    protected Object buildBinaryObject(String typeName, JdbcTypeField[] fields,
         Collection<String> hashFields, Map<String, Integer> loadColIdxs, ResultSet rs) throws CacheLoaderException {
-        Map<String, Integer> cacheTypeIds = binariesTypeIds.get(cacheName);
-
-        if (cacheTypeIds == null)
-            throw new CacheLoaderException("Failed to find binary types IDs for cache: " + U.maskName(cacheName));
-
-        Integer typeId = cacheTypeIds.get(typeName);
-
-        if (typeId == null)
-            throw new CacheLoaderException("Failed to find binary type ID for type: " + typeName);
-
         try {
-            BinaryObjectBuilder builder = ignite.binary().builder(typeId);
+            BinaryObjectBuilder builder = ignite.binary().builder(typeName);
 
             boolean calcHash = hashFields != null;
 
@@ -316,9 +301,6 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
     @Override protected void prepareBuilders(@Nullable String cacheName, Collection<JdbcType> types)
         throws CacheException {
         Map<String, PojoMethodsCache> pojoMethods = U.newHashMap(types.size() * 2);
-        Map<String, Integer> typeIds = U.newHashMap(types.size() * 2);
-
-        IgniteBinary binary = ignite.binary();
 
         for (JdbcType type : types) {
             String keyTypeName = type.getKeyType();
@@ -332,8 +314,6 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
 
                 pojoMethods.put(keyTypeName, new PojoMethodsCache(keyTypeName, type.getKeyFields()));
             }
-            else if (keyKind == TypeKind.BINARY)
-                typeIds.put(keyTypeName, binary.typeId(keyTypeName));
 
             String valTypeName = type.getValueType();
 
@@ -341,8 +321,6 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
 
             if (valKind == TypeKind.POJO)
                 pojoMethods.put(valTypeName, new PojoMethodsCache(valTypeName, type.getValueFields()));
-            else if (valKind == TypeKind.BINARY)
-                typeIds.put(valTypeName, binary.typeId(valTypeName));
         }
 
         if (!pojoMethods.isEmpty()) {
@@ -352,14 +330,6 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
 
             pojosMethods = newPojosMethods;
         }
-
-        if (!typeIds.isEmpty()) {
-            Map<String, Map<String, Integer>> newBinariesTypeIds = new HashMap<>(binariesTypeIds);
-
-            newBinariesTypeIds.put(cacheName, typeIds);
-
-            binariesTypeIds = newBinariesTypeIds;
-        }
     }
 
     /**