Minors.

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

Branch: refs/heads/ignite-3914
Commit: eaf154f0d323a74d9c434b0d3358a2d1338b25ed
Parents: d89e437
Author: vozerov-gridgain <voze...@gridgain.com>
Authored: Fri Sep 16 17:13:46 2016 +0300
Committer: vozerov-gridgain <voze...@gridgain.com>
Committed: Fri Sep 16 17:13:46 2016 +0300

----------------------------------------------------------------------
 .../processors/hadoop/HadoopClassLoader.java    | 16 +++++++-------
 .../processors/hadoop/HadoopNoopHelper.java     | 22 +++++++++++---------
 .../processors/hadoop/HadoopHelperImpl.java     | 11 ----------
 3 files changed, 20 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf154f0/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
index b0e148b..5297cea 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
@@ -90,7 +90,7 @@ public class HadoopClassLoader extends URLClassLoader 
implements ClassCache {
     private final String[] libNames;
 
     /** Igfs Helper. */
-    private final HadoopHelper hadoopHelper;
+    private final HadoopHelper helper;
 
     /**
      * Gets name for Job class loader. The name is specific for local node id.
@@ -121,14 +121,14 @@ public class HadoopClassLoader extends URLClassLoader 
implements ClassCache {
      * @param name Classloader name.
      * @param libNames Optional additional native library names to be linked 
from parent classloader.
      */
-    public HadoopClassLoader(URL[] urls, String name, @Nullable String[] 
libNames, HadoopHelper hadoopHelper) {
+    public HadoopClassLoader(URL[] urls, String name, @Nullable String[] 
libNames, HadoopHelper helper) {
         super(addHadoopUrls(urls), APP_CLS_LDR);
 
         assert !(getParent() instanceof HadoopClassLoader);
 
         this.name = name;
         this.libNames = libNames;
-        this.hadoopHelper = hadoopHelper;
+        this.helper = helper;
 
         initializeNativeLibraries();
     }
@@ -194,7 +194,7 @@ public class HadoopClassLoader extends URLClassLoader 
implements ClassCache {
     @Override protected Class<?> loadClass(String name, boolean resolve) 
throws ClassNotFoundException {
         try {
             // Always load Hadoop classes explicitly, since Hadoop can be 
available in App classpath.
-            if (hadoopHelper.isHadoop(name)) {
+            if (helper.isHadoop(name)) {
                 if (name.equals(CLS_SHUTDOWN_HOOK_MANAGER))  // Dirty hack to 
get rid of Hadoop shutdown hooks.
                     return loadReplace(name, 
CLS_SHUTDOWN_HOOK_MANAGER_REPLACE);
                 else if (name.equals(CLS_DAEMON))
@@ -206,7 +206,7 @@ public class HadoopClassLoader extends URLClassLoader 
implements ClassCache {
             }
 
             // For Ignite Hadoop and IGFS classes we have to check if they 
depend on Hadoop.
-            if (hadoopHelper.isHadoopIgfs(name)) {
+            if (helper.isHadoopIgfs(name)) {
                 if (hasExternalDependencies(name))
                     return loadClassExplicitly(name, resolve);
             }
@@ -236,9 +236,9 @@ public class HadoopClassLoader extends URLClassLoader 
implements ClassCache {
             byte[] bytes = bytesCache.get(originalName);
 
             if (bytes == null) {
-                InputStream in = hadoopHelper.loadClassBytes(getParent(), 
replaceName);
+                InputStream in = helper.loadClassBytes(getParent(), 
replaceName);
 
-                bytes = hadoopHelper.loadReplace(in, originalName, 
replaceName);
+                bytes = helper.loadReplace(in, originalName, replaceName);
 
                 bytesCache.put(originalName, bytes);
             }
@@ -296,7 +296,7 @@ public class HadoopClassLoader extends URLClassLoader 
implements ClassCache {
      * @return {@code True} if class has external dependencies.
      */
     boolean hasExternalDependencies(String clsName) {
-        return hadoopHelper.hasExternalDependencies(clsName, getParent());
+        return helper.hasExternalDependencies(clsName, getParent());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf154f0/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopHelper.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopHelper.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopHelper.java
index c09668e..464ab24 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopHelper.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopHelper.java
@@ -8,33 +8,35 @@ import org.jetbrains.annotations.Nullable;
  * Noop Hadoop Helper implementation.
  */
 public class HadoopNoopHelper implements HadoopHelper {
-    /** Constructor required by the engine. */
-    public HadoopNoopHelper(GridKernalContext ctx) {
-        // nool
-    }
-
     /** {@inheritDoc} */
     @Override public boolean hasExternalDependencies(String clsName, 
ClassLoader parentClsLdr) {
-        return false;
+        throw unsupported();
     }
 
     /** {@inheritDoc} */
     @Override public byte[] loadReplace(InputStream in, String originalName, 
String replaceName) {
-        return new byte[0];
+        throw unsupported();
     }
 
     /** {@inheritDoc} */
     @Override public boolean isHadoop(String cls) {
-        return false;
+        throw unsupported();
     }
 
     /** {@inheritDoc} */
     @Override public boolean isHadoopIgfs(String cls) {
-        return false;
+        throw unsupported();
     }
 
     /** {@inheritDoc} */
     @Nullable @Override public InputStream loadClassBytes(ClassLoader ldr, 
String clsName) {
-        return null;
+        throw unsupported();
+    }
+
+    /**
+     * @return Exception.
+     */
+    private static UnsupportedOperationException unsupported() {
+        throw new UnsupportedOperationException("Operation is unsupported 
(Hadoop module is not in the classpath).");
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf154f0/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopHelperImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopHelperImpl.java
 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopHelperImpl.java
index a06d3ba..0415124 100644
--- 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopHelperImpl.java
+++ 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopHelperImpl.java
@@ -16,7 +16,6 @@
  */
 package org.apache.ignite.internal.processors.hadoop;
 
-import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.util.typedef.F;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
@@ -47,16 +46,6 @@ public class HadoopHelperImpl implements HadoopHelper {
     /** Cache for resolved dependency info. */
     private static final Map<String, Boolean> dependenciesCache = new 
ConcurrentHashMap8<>();
 
-    /**  */
-    public HadoopHelperImpl() {
-        this(null);
-    }
-
-    /** Constructor required by the engine. */
-    public HadoopHelperImpl(GridKernalContext ctx) {
-        // nool
-    }
-
     /**
      * Load special replacement and impersonate
      *

Reply via email to