Skip to content

Commit

Permalink
Reduce allocation of hadoop configuration objects
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Aug 11, 2015
1 parent a0a1bae commit 7365f1a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,25 @@
import javax.inject.Inject;

import java.net.URI;
import java.util.Map;

import static com.google.common.base.Preconditions.checkNotNull;

public class HiveHdfsConfiguration
implements HdfsConfiguration
{
private static final Configuration DEFAULT_CONFIGURATION = new Configuration();

@SuppressWarnings("ThreadLocalNotStaticFinal")
private final ThreadLocal<Configuration> hadoopConfiguration = new ThreadLocal<Configuration>()
{
@Override
protected Configuration initialValue()
{
Configuration config = new Configuration();
Configuration config = new Configuration(false);
for (Map.Entry<String, String> entry : DEFAULT_CONFIGURATION) {
config.set(entry.getKey(), entry.getValue());
}
updater.updateConfiguration(config);
return config;
}
Expand Down

0 comments on commit 7365f1a

Please sign in to comment.