diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java index 4921966..507fae4 100755 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map.Entry; import org.apache.commons.logging.Log; @@ -184,14 +185,12 @@ public void configure(JobConf job) { /** * A cache of InputFormat instances. */ - protected static Map> inputFormats; + protected static Map> inputFormats + = new ConcurrentHashMap>(); public static InputFormat getInputFormatFromCache( Class inputFormatClass, JobConf job) throws IOException { - if (inputFormats == null) { - inputFormats = new HashMap>(); - } if (!inputFormats.containsKey(inputFormatClass)) { try { InputFormat newInstance = (InputFormat) ReflectionUtils