hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiten...@apache.org
Subject svn commit: r1101570 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/FileContext.java src/test/core/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java
Date Tue, 10 May 2011 18:01:40 GMT
Author: jitendra
Date: Tue May 10 18:01:39 2011
New Revision: 1101570

URL: http://svn.apache.org/viewvc?rev=1101570&view=rev
Log:
HADOOP-7268. FileContext.getLocalFSFileContext() behavior needs to be fixed w.r.t tokens.
Contributed by jitendra.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileContext.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1101570&r1=1101569&r2=1101570&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Tue May 10 18:01:39 2011
@@ -188,6 +188,9 @@ Trunk (unreleased changes)
 
     HADOOP-7261. Disable IPV6 for junit tests. (suresh)
 
+    HADOOP-7268. FileContext.getLocalFSFileContext() behavior needs to be fixed
+    w.r.t tokens. (jitendra)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileContext.java?rev=1101570&r1=1101569&r2=1101570&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileContext.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileContext.java Tue May 10 18:01:39
2011
@@ -169,7 +169,6 @@ public final class FileContext {
   
   public static final Log LOG = LogFactory.getLog(FileContext.class);
   public static final FsPermission DEFAULT_PERM = FsPermission.getDefault();
-  volatile private static FileContext localFsSingleton = null;
   
   /**
    * List of files that should be deleted on JVM shutdown.
@@ -388,10 +387,7 @@ public final class FileContext {
    */
   public static FileContext getLocalFSFileContext()
       throws UnsupportedFileSystemException {
-    if (localFsSingleton == null) {
-      localFsSingleton = getFileContext(FsConstants.LOCAL_FS_URI); 
-    }
-    return localFsSingleton;
+    return getFileContext(FsConstants.LOCAL_FS_URI);
   }
 
   /**

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java?rev=1101570&r1=1101569&r2=1101570&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java
Tue May 10 18:01:39 2011
@@ -21,7 +21,9 @@ package org.apache.hadoop.fs;
 import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
+import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Test;
 
 public class TestLocalFSFileContextMainOperations extends FileContextMainOperationsBaseTest
{
 
@@ -37,4 +39,10 @@ public class TestLocalFSFileContextMainO
       wd = FileSystem.getLocal(new Configuration()).getWorkingDirectory();
     return wd;
   }
+  
+  @Test
+  public void testFileContextNoCache() throws UnsupportedFileSystemException {
+    FileContext fc1 = FileContext.getLocalFSFileContext();
+    Assert.assertTrue(fc1 != fc);
+  }
 }



Mime
View raw message