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