瀏覽代碼

HADOOP-1364. Fix various inconsistent synchronization issues. Contributed by Devaraj.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@540324 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 年之前
父節點
當前提交
0410a5e97c

+ 3 - 0
CHANGES.txt

@@ -36,6 +36,9 @@ Trunk (unreleased changes)
  11. HADOOP-1379.  Add findbugs target to build.xml.
      (Nigel Daley via cutting)
 
+ 12. HADOOP-1364.  Fix various inconsistent synchronization issues.
+     (Devaraj Das via cutting)
+
 
 Branch 0.13 (unreleased changes)
 

+ 1 - 1
src/java/org/apache/hadoop/conf/Configuration.java

@@ -689,7 +689,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>> {
   /** Make this class quiet. Error and informational
    *  messages might not be logged.
    */
-  public void setQuietMode(boolean value) {
+  public synchronized void setQuietMode(boolean value) {
     quietmode = value;
   }
 

+ 5 - 5
src/java/org/apache/hadoop/ipc/Server.java

@@ -286,12 +286,12 @@ public abstract class Server {
       }
       LOG.info("Stopping " + this.getName());
 
-      try {
-        acceptChannel.close();
-        selector.close();
-      } catch (IOException e) { }
-
       synchronized (this) {
+        try {
+          acceptChannel.close();
+          selector.close();
+        } catch (IOException e) { }
+
         selector= null;
         acceptChannel= null;
         connectionList = null;

+ 1 - 1
src/java/org/apache/hadoop/mapred/MapTask.java

@@ -329,7 +329,7 @@ class MapTask extends Task {
                                                                 job.getClass("map.sort.class", MergeSorter.class,
                                                                              BufferSorter.class), job);
     }
-    public void startPartition(int partNumber) throws IOException {
+    private void startPartition(int partNumber) throws IOException {
       //We create the sort output as multiple sequence files within a spilled
       //file. So we create a writer for each partition. 
       segmentStart = out.getPos();

+ 2 - 2
src/java/org/apache/hadoop/mapred/TaskLog.java

@@ -367,7 +367,7 @@ class TaskLog {
      *         purged data.
      * @throws IOException
      */
-    public long getTotalLogSize() throws IOException {
+    public synchronized long getTotalLogSize() throws IOException {
       if (!initialized) {
         init();
       }
@@ -381,7 +381,7 @@ class TaskLog {
      * @return Returns a <code>byte[]</code> containing the data in user-log.
      * @throws IOException
      */
-    public byte[] fetchAll() throws IOException {
+    public synchronized byte[] fetchAll() throws IOException {
       if (!initialized) {
         init();
       }