ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject incubator-ignite git commit: # IGNITE-141 - Marshallers refactoring
Date Tue, 03 Mar 2015 02:34:45 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-141 7032bdd15 -> 3c340cc9e


# IGNITE-141 - Marshallers refactoring


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

Branch: refs/heads/ignite-141
Commit: 3c340cc9eda1649be61f70c22f17053271fecdcf
Parents: 7032bdd
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Mon Mar 2 18:35:29 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Mon Mar 2 18:35:29 2015 -0800

----------------------------------------------------------------------
 .../ignite/internal/MarshallerContextImpl.java  |  2 ++
 .../marshaller/MarshallerContextTestImpl.java   | 30 ++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c340cc9/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index 9c3744c..4a31931 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -63,6 +63,8 @@ public class MarshallerContextImpl implements MarshallerContext {
             }
         }
         catch (ClassNotFoundException ignored) {
+            U.debug("IGNORED: " + clsName);
+
             if (log.isDebugEnabled())
                 log.debug("Class defined in classnames.properties doesn't exist (ignoring):
" + clsName);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c340cc9/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
index 86cb63a..fba18a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
@@ -17,6 +17,9 @@
 
 package org.apache.ignite.marshaller;
 
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
 import java.util.*;
 
 /**
@@ -24,8 +27,35 @@ import java.util.*;
  */
 public class MarshallerContextTestImpl implements MarshallerContext {
     /** */
+    private static final String CLS_NAMES_FILE = "org/apache/ignite/internal/classnames.properties";
+
+    /** */
     private final Map<Integer, Class> map = new HashMap<>();
 
+    /**
+     */
+    public MarshallerContextTestImpl() {
+        try {
+            ClassLoader ldr = getClass().getClassLoader();
+
+            BufferedReader rdr = new BufferedReader(new InputStreamReader(ldr.getResourceAsStream(CLS_NAMES_FILE)));
+
+            String clsName;
+
+            while ((clsName = rdr.readLine()) != null) {
+                Class cls = U.forName(clsName, ldr);
+
+                map.put(cls.getName().hashCode(), cls);
+            }
+        }
+        catch (ClassNotFoundException ignored) {
+            // No-op.
+        }
+        catch (IOException e) {
+            throw new IllegalStateException("Failed to initialize marshaller context.", e);
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public void registerClass(int id, Class cls) {
         map.put(id, cls);


Mime
View raw message