HADOOP-7268. FileContext.getLocalFSFileContext() behavior needs to be fixed w.r.t tokens. Contributed by jitendra.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1101570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jitendra Nath Pandey 2011-05-10 18:01:39 +00:00
parent 3337cdb312
commit 1bbebd1e3f
3 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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);
}
/**

View File

@ -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 TestLocalFSFileContextMainOperations extends FileContextMainOperati
wd = FileSystem.getLocal(new Configuration()).getWorkingDirectory();
return wd;
}
@Test
public void testFileContextNoCache() throws UnsupportedFileSystemException {
FileContext fc1 = FileContext.getLocalFSFileContext();
Assert.assertTrue(fc1 != fc);
}
}