HADOOP-8406. CompressionCodecFactory.CODEC_PROVIDERS iteration is thread-unsafe. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1339476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ba1e4a823a
commit
026d0b4d53
|
@ -175,6 +175,9 @@ Release 2.0.1-alpha - UNRELEASED
|
|||
|
||||
HADOOP-8400. All commands warn "Kerberos krb5 configuration not found" when security is not enabled. (tucu)
|
||||
|
||||
HADOOP-8406. CompressionCodecFactory.CODEC_PROVIDERS iteration is
|
||||
thread-unsafe (todd)
|
||||
|
||||
Release 2.0.0-alpha - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -109,8 +109,12 @@ public class CompressionCodecFactory {
|
|||
List<Class<? extends CompressionCodec>> result
|
||||
= new ArrayList<Class<? extends CompressionCodec>>();
|
||||
// Add codec classes discovered via service loading
|
||||
for (CompressionCodec codec : CODEC_PROVIDERS) {
|
||||
result.add(codec.getClass());
|
||||
synchronized (CODEC_PROVIDERS) {
|
||||
// CODEC_PROVIDERS is a lazy collection. Synchronize so it is
|
||||
// thread-safe. See HADOOP-8406.
|
||||
for (CompressionCodec codec : CODEC_PROVIDERS) {
|
||||
result.add(codec.getClass());
|
||||
}
|
||||
}
|
||||
// Add codec classes from configuration
|
||||
String codecsString = conf.get("io.compression.codecs");
|
||||
|
|
Loading…
Reference in New Issue