示例#1
0
  @Override
  public void init(Configuration conf) {
    tajoConf = TUtil.checkTypeAndGet(conf, TajoConf.class);
    rpcParams = RpcParameterFactory.get(new TajoConf());

    scheduledRequests = new ScheduledRequests();
    minTaskMemory = tajoConf.getIntVar(TajoConf.ConfVars.TASK_RESOURCE_MINIMUM_MEMORY);
    schedulerDelay = tajoConf.getIntVar(TajoConf.ConfVars.QUERYMASTER_TASK_SCHEDULER_DELAY);
    isLeaf = stage.getMasterPlan().isLeaf(stage.getBlock());

    this.schedulingThread =
        new Thread() {
          public void run() {

            while (!isStopped && !Thread.currentThread().isInterrupted()) {

              try {
                schedule();
              } catch (InterruptedException e) {
                if (isStopped) {
                  break;
                } else {
                  LOG.fatal(e.getMessage(), e);
                  stage.abort(StageState.ERROR);
                }
              } catch (Throwable e) {
                LOG.fatal(e.getMessage(), e);
                stage.abort(StageState.ERROR);
                break;
              }
            }
            LOG.info("TaskScheduler schedulingThread stopped");
          }
        };
    super.init(conf);
  }