title: Propagating custom configuration values in Hadoop
body: <p>Is there any way to set and (later) get a custom configuration object in Hadoop, during Map/Reduce?</p>
  
  <p>For example, assume an application that preprocesses a large file and determines dynamically some characteristics related to the file. Furthermore, assume that those characteristics are saved in a custom Java object (e.g., a <code>Properties</code> object, but not exclusively, since some may not be strings) and are subsequently necessary for each of the map and of the reduce jobs.</p>
  
  <p>How could the application "propagate" this configuration, so that each mapper and reducer function can access it, when needed?</p>
  
  <p>One approach could be to use the <code>set(String, String)</code> method of the <code>JobConf</code> class and, for instance, pass the configuration object serialized as a <code>JSON</code> string via the second parameter, but this may be too much of a hack and then the appropriate <code>JobConf</code> instance must be accessed by each <code>Mapper</code> and <code>Reducer</code> anyway (e.g., following an approach like the one suggested in an <a href="https://stackoverflow.com/questions/5696773/how-to-retrieve-hadoop-job-configuration-based-on-job-id-that-is-currently-runni">earlier question</a>).</p>