incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1022835 - in /incubator/hama/trunk: CHANGES.txt src/java/org/apache/hama/bsp/BSPMaster.java src/test/org/apache/hama/bsp/TestClusterStatus.java
Date Fri, 15 Oct 2010 06:59:57 GMT
Author: edwardyoon
Date: Fri Oct 15 06:59:57 2010
New Revision: 1022835

URL: http://svn.apache.org/viewvc?rev=1022835&view=rev
Log:
BSPMaster - job ID counter is not read and updated atomically

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java
    incubator/hama/trunk/src/test/org/apache/hama/bsp/TestClusterStatus.java   (props changed)

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1022835&r1=1022834&r2=1022835&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Fri Oct 15 06:59:57 2010
@@ -168,6 +168,8 @@ Trunk (unreleased changes)
 
   BUG FIXES
   
+    HAMA-307: BSPMaster - job ID counter is not read and updated atomically
+                      (Filipe Manana via edward)
     HAMA-305: Redundant use of synchronize keyword (Filipe Manana via edward)
     HAMA-301: Fix unit test fail bug (edwardyoon)
     HAMA-303: slave.host.name is superceded by bsp.peer.hostname 

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java?rev=1022835&r1=1022834&r2=1022835&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java Fri Oct 15 06:59:57 2010
@@ -92,7 +92,7 @@ public class BSPMaster implements JobSub
   private HashMap<String, String> groomServerHosts = new HashMap<String, String>();
 
   // Jobs' Meta Data
-  private int nextJobId = 1;
+  private Integer nextJobId = Integer.valueOf(1);
   // private long startTime;
   private int totalSubmissions = 0;
   private int totalTasks = 0;
@@ -528,7 +528,12 @@ public class BSPMaster implements JobSub
    */
   @Override
   public BSPJobID getNewJobId() throws IOException {
-    return new BSPJobID(this.masterIdentifier, nextJobId++);
+    int id;
+    synchronized (nextJobId) {
+      id = nextJobId;
+      nextJobId = Integer.valueOf(id + 1);
+    }
+    return new BSPJobID(this.masterIdentifier, id);
   }
 
   @Override

Propchange: incubator/hama/trunk/src/test/org/apache/hama/bsp/TestClusterStatus.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message