ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # save.
Date Tue, 23 Jun 2015 12:00:35 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1044 [created] 28cf57854


# save.


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

Branch: refs/heads/ignite-1044
Commit: 28cf578548d75c36269e02e010dee67bc8863ef1
Parents: 3b49184
Author: iveselovskiy <iveselovskiy@gridgain.com>
Authored: Tue Jun 23 15:00:14 2015 +0300
Committer: iveselovskiy <iveselovskiy@gridgain.com>
Committed: Tue Jun 23 15:00:14 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/hadoop/v2/HadoopV2Job.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/28cf5785/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 33a218d..385747c 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
@@ -40,6 +40,7 @@ import java.net.*;
 import java.util.*;
 import java.util.Queue;
 import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.internal.processors.hadoop.HadoopUtils.*;
 import static org.apache.ignite.internal.processors.hadoop.fs.HadoopFileSystemCacheUtils.*;
@@ -85,6 +86,8 @@ public class HadoopV2Job implements HadoopJob {
     /** Serialized JobConf. */
     private volatile byte[] jobConfData;
 
+    private final AtomicBoolean disposed = new AtomicBoolean();
+
     /**
      * @param jobId Job ID.
      * @param jobInfo Job info.
@@ -271,6 +274,11 @@ public class HadoopV2Job implements HadoopJob {
     /** {@inheritDoc} */
     @SuppressWarnings("ThrowFromFinallyBlock")
     @Override public void dispose(boolean external) throws IgniteCheckedException {
+        boolean dsp = disposed.compareAndSet(false, true);
+
+        if (!dsp)
+            throw new AssertionError("Attempt to dispose Job 2nd time: " + S.toString(HadoopV2Job.class,
this));
+
         try {
             if (rsrcMgr != null && !external) {
                 File jobLocDir = jobLocalDir(locNodeId, jobId);
@@ -399,4 +407,11 @@ public class HadoopV2Job implements HadoopJob {
     public FileSystem fileSystem(@Nullable URI uri, Configuration cfg) throws IOException
{
         return fileSystemForMrUserWithCaching(uri, cfg, fsMap);
     }
+
+    @Override protected void finalize() throws Throwable {
+        super.finalize();
+
+        if (!disposed.get())
+            throw new AssertionError("Job was not disposed: " + S.toString(HadoopV2Job.class,
this));
+    }
 }


Mime
View raw message