문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top