HADOOP-8587. HarFileSystem access of harMetaCache isn't threadsafe. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1360448 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-07-11 22:28:54 +00:00
parent cdae6953e8
commit 4c13b6f34e
2 changed files with 6 additions and 3 deletions

View File

@ -331,6 +331,8 @@ Branch-2 ( Unreleased changes )
HADOOP-3886. Error in javadoc of Reporter, Mapper and Progressable
(Jingguo Yao via harsh)
HADOOP-8587. HarFileSystem access of harMetaCache isn't threadsafe. (eli)
BREAKDOWN OF HDFS-3042 SUBTASKS
HADOOP-8220. ZKFailoverController doesn't handle failure to become active

View File

@ -24,11 +24,11 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.permission.FsPermission;
@ -52,7 +52,8 @@ import org.apache.hadoop.util.Progressable;
public class HarFileSystem extends FilterFileSystem {
public static final int VERSION = 3;
private static final Map<URI, HarMetaData> harMetaCache = new HashMap<URI, HarMetaData>();
private static final Map<URI, HarMetaData> harMetaCache =
new ConcurrentHashMap<URI, HarMetaData>();
// uri representation of this Har filesystem
private URI uri;
@ -1055,7 +1056,7 @@ public class HarFileSystem extends FilterFileSystem {
FileStatus archiveStat = fs.getFileStatus(archiveIndexPath);
archiveIndexTimestamp = archiveStat.getModificationTime();
LineReader aLin;
String retStr = null;
// now start reading the real index file
for (Store s: stores) {
read = 0;