HadoopSourceAnalyse --- Nodemanager Application FSM

overview

INIT_APPLICATION Handle

收到 该 事件通知,Application 保存当前的用户的ACL信息,并通知logHandler,记录用户信息,App进入INITING状态:

 app.applicationACLs = initEvent.getApplicationACLs();
      app.aclsManager.addApplication(app.getAppId(), app.applicationACLs);
      // Inform the logAggregator
      app.dispatcher.getEventHandler().handle(
          new LogHandlerAppStartedEvent(app.appId, app.user,
              app.credentials, ContainerLogsRetentionPolicy.ALL_CONTAINERS,
              app.applicationACLs)); 

LogHandler记录用户信息之后,发送事件通知:APPLICATION_LOG_HANDLING_INITED 到App
this.appOwners.put(appStartedEvent.getApplicationId(),
            appStartedEvent.getUser());
        this.dispatcher.getEventHandler().handle(
            new ApplicationEvent(appStartedEvent.getApplicationId(),
                ApplicationEventType.APPLICATION_LOG_HANDLING_INITED));

APPLICATION_LOG_HANDLING_INITED Handle

收到该事件之后,App 发送ApplicationLocalizationEvent 去请求Localization Resource 信息。在请求的resource 返回之前,App一直停留在INITING状态:
 app.dispatcher.getEventHandler().handle(
          new ApplicationLocalizationEvent(
              LocalizationEventType.INIT_APPLICATION_RESOURCES, app));

ResourceLocalizationService收到该事件之后,为前用户初始化LocalResourceTracker对像,并发送:APPLICATION_INITED 通知App:
 privateRsrc.putIfAbsent(userName, new LocalResourcesTrackerImpl(userName,
      dispatcher, true, super.getConfig()));
    if (null != appRsrc.putIfAbsent(
      ConverterUtils.toString(app.getAppId()),
      new LocalResourcesTrackerImpl(app.getUser(), dispatcher, false, super
        .getConfig()))) {
      LOG.warn("Initializing application " + app + " already present");
      assert false; // TODO: FIXME assert doesn't help
                    // ^ The condition is benign. Tests should fail and it
                    // should appear in logs, but it's an internal error
                    // that should have no effect on applications
    }
    // 1) Signal container init
    //
    // This is handled by the ApplicationImpl state machine and allows
    // containers to proceed with launching.
    dispatcher.getEventHandler().handle(new ApplicationInitedEvent(
          app.getAppId()));

APPLICATION_INITED Handle

收到该事件,App将发送INIT_CONTAINER 通知container初始化, App进入Running状态:
 // Start all the containers waiting for ApplicationInit
      for (Container container : app.containers.values()) {
        app.dispatcher.getEventHandler().handle(new ContainerInitEvent(
              container.getContainer().getId()));
      }
之后App 等待Finish事件,并 执行保存清理工作, 并退出 。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值