Переглянути джерело

This fixes a bug that was introeuced by an earlier checkin to
HADOOP-2891 (DFSClient.close() closes all open files.). The
DFSClient.close release the lock on the outputstream before
acquiring the lock on pendingCreates.



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@632229 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 17 роки тому
батько
коміт
4f75ca0313
1 змінених файлів з 10 додано та 7 видалено
  1. 10 7
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 10 - 7
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -2218,10 +2218,14 @@ class DFSClient implements FSConstants {
       }
       }
     }
     }
   
   
-    private void internalClose() throws IOException {
-      // Clean up any resources that might be held.
-      closed = true;
-      
+    /**
+     * Closes this output stream and releases any system 
+     * resources associated with this stream.
+     */
+    @Override
+    public void close() throws IOException {
+      closeInternal();
+
       synchronized (pendingCreates) {
       synchronized (pendingCreates) {
         pendingCreates.remove(src);
         pendingCreates.remove(src);
       }
       }
@@ -2236,8 +2240,7 @@ class DFSClient implements FSConstants {
      * Closes this output stream and releases any system 
      * Closes this output stream and releases any system 
      * resources associated with this stream.
      * resources associated with this stream.
      */
      */
-    @Override
-    public synchronized void close() throws IOException {
+    private synchronized void closeInternal() throws IOException {
       checkOpen();
       checkOpen();
       isClosed();
       isClosed();
 
 
@@ -2306,7 +2309,7 @@ class DFSClient implements FSConstants {
       } catch (InterruptedException e) {
       } catch (InterruptedException e) {
         throw new IOException("Failed to shutdown response thread");
         throw new IOException("Failed to shutdown response thread");
       } finally {
       } finally {
-        internalClose();
+        closed = true;
       }
       }
     }
     }