Quetzalcoatl
Quetzalcoatl

Reputation: 3067

Accessing hadoop config setting without having to pass Configuration object through many layers

In the hadoop project I am working on, I need to access a setting in the hadoop Configuration object. However, I only need this setting many, many layers into the reducer, and I really would rather not pass the Context or Configuration objects through so many constructors just for this purpose.

Is there a way I can somehow get access to this setting without passing the configuration through everything between the reducer and the actual class that needs it?

One potential solution I have in mind is to set the configuration setting as a java system property at the start of the reducer, so that way I can access it using System.getProperty() but I'd like to know if there are any cleaner methods.

Upvotes: 1

Views: 208

Answers (1)

Chris Gerken
Chris Gerken

Reputation: 16392

If it's all in the same JVM you could set a static class variable in the reducer's setup() method... or any other class as appropriate.

Upvotes: 1

Related Questions