Repository: ignite
Updated Branches:
  refs/heads/ignite-3902 587cc46af -> 9712eab7e


Further fixes.


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

Branch: refs/heads/ignite-3902
Commit: 9712eab7e43cc1d3f7d06195ce83016318f77f56
Parents: 587cc46
Author: vozerov-gridgain <voze...@gridgain.com>
Authored: Thu Sep 15 11:24:47 2016 +0300
Committer: vozerov-gridgain <voze...@gridgain.com>
Committed: Thu Sep 15 11:24:47 2016 +0300

----------------------------------------------------------------------
 .../processors/hadoop/HadoopDefaultJobInfo.java |  1 -
 .../internal/processors/hadoop/HadoopUtils.java | 16 ------------
 .../processors/hadoop/v2/HadoopV2Job.java       | 26 +++++++++++---------
 3 files changed, 15 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9712eab7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
index be2d9ca..1382c1f 100644
--- 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
+++ 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
@@ -92,7 +92,6 @@ public class HadoopDefaultJobInfo implements HadoopJobInfo, 
Externalizable {
 
             return constructor.newInstance(jobId, this, log, libNames);
         }
-        // NB: java.lang.NoClassDefFoundError may be thrown from 
Class#getConstructor() call.
         catch (Throwable t) {
             if (t instanceof Error)
                 throw (Error)t;

http://git-wip-us.apache.org/repos/asf/ignite/blob/9712eab7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
index 976119e..054a96c 100644
--- 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
+++ 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
@@ -339,22 +339,6 @@ public class HadoopUtils {
     }
 
     /**
-     * Creates {@link JobConf} in a correct class loader context to avoid 
caching
-     * of inappropriate class loader in the Configuration object.
-     * @return New instance of {@link JobConf}.
-     */
-    public static JobConf safeCreateJobConf() {
-        final ClassLoader oldLdr = 
setContextClassLoader(JobConf.class.getClassLoader());
-
-        try {
-            return new JobConf();
-        }
-        finally {
-            restoreContextClassLoader(oldLdr);
-        }
-    }
-
-    /**
      * Sort input splits by length.
      *
      * @param splits Splits.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9712eab7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
index 2357ef5..81a5266 100644
--- 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
+++ 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
@@ -139,18 +139,25 @@ public class HadoopV2Job implements HadoopJob {
         this.jobInfo = jobInfo;
         this.libNames = libNames;
 
-        hadoopJobID = new JobID(jobId.globalId().toString(), jobId.localId());
+        ClassLoader oldLdr = 
HadoopUtils.setContextClassLoader(getClass().getClassLoader());
 
-        jobConf = HadoopUtils.safeCreateJobConf();
+        try {
+            hadoopJobID = new JobID(jobId.globalId().toString(), 
jobId.localId());
+
+            jobConf = new JobConf();
 
-        HadoopFileSystemsUtils.setupFileSystems(jobConf);
+            HadoopFileSystemsUtils.setupFileSystems(jobConf);
 
-        for (Map.Entry<String,String> e : jobInfo.properties().entrySet())
-            jobConf.set(e.getKey(), e.getValue());
+            for (Map.Entry<String,String> e : jobInfo.properties().entrySet())
+                jobConf.set(e.getKey(), e.getValue());
 
-        jobCtx = new JobContextImpl(jobConf, hadoopJobID);
+            jobCtx = new JobContextImpl(jobConf, hadoopJobID);
 
-        rsrcMgr = new HadoopV2JobResourceManager(jobId, jobCtx, log, this);
+            rsrcMgr = new HadoopV2JobResourceManager(jobId, jobCtx, log, this);
+        }
+        finally {
+            HadoopUtils.setContextClassLoader(oldLdr);
+        }
     }
 
     /** {@inheritDoc} */
@@ -295,10 +302,7 @@ public class HadoopV2Job implements HadoopJob {
 
         this.locNodeId = locNodeId;
 
-        assert ((HadoopClassLoader)getClass().getClassLoader()).name()
-            .equals(HadoopClassLoader.nameForJob(this.locNodeId));
-
-        ClassLoader oldLdr = 
HadoopUtils.setContextClassLoader(jobConf.getClassLoader());
+        ClassLoader oldLdr = 
HadoopUtils.setContextClassLoader(getClass().getClassLoader());
 
         try {
             rsrcMgr.prepareJobEnvironment(!external, jobLocalDir(locNodeId, 
jobId));

Reply via email to