Java Code Examples for org.apache.hadoop.conf.Configuration.reloadConfiguration()

The following are Jave code examples for showing how to use reloadConfiguration() of the org.apache.hadoop.conf.Configuration class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: spydra   File: HistoryLogUtils.java   Source Code and License Vote up 6 votes
/**
 * Creates a specialized hadoop configuration for spydra. This configuration is
 * special in the sense that it configures hadoop tooling to be able to access GCS
 * for logs, history and is able to run a read-only job-history server (not moving
 * or deleting logs or history files). This configuration is dependent on client
 * and username due to how this information is stored in GCS.
 *
 * @param clientId client id to generate configuration for
 * @param username username to generate configuration for
 * @param bucket   name of the bucket storing logs and history information
 */
public static Configuration generateHadoopConfig(String clientId, String username,
    String bucket) {
  // We want minimalistic and clean options that are unlikely to collide with anything,
  // that's why not loading defaults
  Configuration cfg = new Configuration(false);
  cfg.addResource(HISTORY_LOG_CONFIG_NAME);
  cfg.reloadConfiguration();
  cfg.set(SPYDRA_HISTORY_CLIENT_ID_PROPERTY, clientId);
  cfg.set(SPYDRA_HISTORY_USERNAME_PROPERTY, username);
  cfg.set(SPYDRA_HISTORY_BUCKET_PROPERTY, bucket);

  if (logger.isDebugEnabled()) {
    logger.debug("Dumping generated config to be applied for log/history tools");
    logger.debug(Joiner.on("\n").join(cfg.iterator()));
  }

  return cfg;
}