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

The following are Jave code examples for showing how to use getTimeDuration() 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: hadoop   File: AbstractReservationSystem.java   Source Code and License Vote up 6 votes
private void initialize(Configuration conf) throws YarnException {
  LOG.info("Initializing Reservation system");
  this.conf = conf;
  scheduler = rmContext.getScheduler();
  // Get the plan step size
  planStepSize =
      conf.getTimeDuration(
          YarnConfiguration.RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP,
          YarnConfiguration.DEFAULT_RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP,
          TimeUnit.MILLISECONDS);
  if (planStepSize < 0) {
    planStepSize =
        YarnConfiguration.DEFAULT_RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP;
  }
  // Create a plan corresponding to every reservable queue
  Set<String> planQueueNames = scheduler.getPlanQueues();
  for (String planQueueName : planQueueNames) {
    Plan plan = initializePlan(planQueueName);
    plans.put(planQueueName, plan);
  }
}