/// <exception cref="System.IO.IOException"/>
        public virtual void ApplicationAttemptFinished(ApplicationAttemptFinishData appAttemptFinish
                                                       )
        {
            ConcurrentMap <ApplicationAttemptId, ApplicationAttemptHistoryData> subMap = GetSubMap
                                                                                             (appAttemptFinish.GetApplicationAttemptId().GetApplicationId());
            ApplicationAttemptHistoryData data = subMap[appAttemptFinish.GetApplicationAttemptId
                                                            ()];

            if (data == null)
            {
                throw new IOException("The finish information of application attempt " + appAttemptFinish
                                      .GetApplicationAttemptId() + " is stored before" + " the start information.");
            }
            // Make the assumption that YarnApplicationAttemptState should not be null
            // if the finish information is already recorded
            if (data.GetYarnApplicationAttemptState() != null)
            {
                throw new IOException("The finish information of application attempt " + appAttemptFinish
                                      .GetApplicationAttemptId() + " is already stored.");
            }
            data.SetTrackingURL(appAttemptFinish.GetTrackingURL());
            data.SetDiagnosticsInfo(appAttemptFinish.GetDiagnosticsInfo());
            data.SetFinalApplicationStatus(appAttemptFinish.GetFinalApplicationStatus());
            data.SetYarnApplicationAttemptState(appAttemptFinish.GetYarnApplicationAttemptState
                                                    ());
        }
 /// <exception cref="System.IO.IOException"/>
 public virtual void ApplicationAttemptFinished(ApplicationAttemptFinishData appAttemptFinish
                                                )
 {
     FileSystemApplicationHistoryStore.HistoryFileWriter hfWriter = GetHistoryFileWriter
                                                                        (appAttemptFinish.GetApplicationAttemptId().GetApplicationId());
     System.Diagnostics.Debug.Assert(appAttemptFinish is ApplicationAttemptFinishDataPBImpl
                                     );
     try
     {
         hfWriter.WriteHistoryData(new FileSystemApplicationHistoryStore.HistoryDataKey(appAttemptFinish
                                                                                        .GetApplicationAttemptId().ToString(), FinishDataSuffix), ((ApplicationAttemptFinishDataPBImpl
                                                                                                                                                    )appAttemptFinish).GetProto().ToByteArray());
         Log.Info("Finish information of application attempt " + appAttemptFinish.GetApplicationAttemptId
                      () + " is written");
     }
     catch (IOException e)
     {
         Log.Error("Error when writing finish information of application attempt " + appAttemptFinish
                   .GetApplicationAttemptId(), e);
         throw;
     }
 }