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

The following are Jave code examples for showing how to use setBooleanIfUnset() 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: ditb   File:   Source Code and License Vote up 6 votes
 * Setup the configuration for a constraint as to whether it is enabled and
 * its priority
 * @param conf
 *          on which to base the new configuration
 * @param enabled
 *          <tt>true</tt> if it should be run
 * @param priority
 *          relative to other constraints
 * @return a new configuration, storable in the {@link HTableDescriptor}
private static Configuration configure(Configuration conf, boolean enabled,
    long priority) {
  // create the configuration to actually be stored
  // clone if possible, but otherwise just create an empty configuration
  Configuration toWrite = conf == null ? new Configuration()
      : new Configuration(conf);

  // update internal properties
  toWrite.setBooleanIfUnset(ENABLED_KEY, enabled);

  // set if unset long
    toWrite.setLong(PRIORITY_KEY, priority);

  return toWrite;