/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> protected internal virtual void SubmitApplication(ApplicationSubmissionContext submissionContext , long submitTime, string user) { ApplicationId applicationId = submissionContext.GetApplicationId(); RMAppImpl application = CreateAndPopulateNewRMApp(submissionContext, submitTime, user, false); ApplicationId appId = submissionContext.GetApplicationId(); if (UserGroupInformation.IsSecurityEnabled()) { try { this.rmContext.GetDelegationTokenRenewer().AddApplicationAsync(appId, ParseCredentials (submissionContext), submissionContext.GetCancelTokensWhenComplete(), application .GetUser()); } catch (Exception e) { Log.Warn("Unable to parse credentials.", e); // Sending APP_REJECTED is fine, since we assume that the // RMApp is in NEW state and thus we haven't yet informed the // scheduler about the existence of the application System.Diagnostics.Debug.Assert(application.GetState() == RMAppState.New); this.rmContext.GetDispatcher().GetEventHandler().Handle(new RMAppEvent(applicationId , RMAppEventType.AppRejected, e.Message)); throw RPCUtil.GetRemoteException(e); } } else { // Dispatcher is not yet started at this time, so these START events // enqueued should be guaranteed to be first processed when dispatcher // gets started. this.rmContext.GetDispatcher().GetEventHandler().Handle(new RMAppEvent(applicationId , RMAppEventType.Start)); } }