public WritingContainerStartEvent(ContainerId containerId, ContainerStartData containerStart
                                   )
     : base(WritingHistoryEventType.ContainerStart)
 {
     this.containerId    = containerId;
     this.containerStart = containerStart;
 }
 /// <exception cref="System.IO.IOException"/>
 public virtual ContainerHistoryData GetContainer(ContainerId containerId)
 {
     FileSystemApplicationHistoryStore.HistoryFileReader hfReader = GetHistoryFileReader
                                                                        (containerId.GetApplicationAttemptId().GetApplicationId());
     try
     {
         bool readStartData  = false;
         bool readFinishData = false;
         ContainerHistoryData historyData = ContainerHistoryData.NewInstance(containerId,
                                                                             null, null, null, long.MinValue, long.MaxValue, null, int.MaxValue, null);
         while ((!readStartData || !readFinishData) && hfReader.HasNext())
         {
             FileSystemApplicationHistoryStore.HistoryFileReader.Entry entry = hfReader.Next();
             if (entry.key.id.Equals(containerId.ToString()))
             {
                 if (entry.key.suffix.Equals(StartDataSuffix))
                 {
                     ContainerStartData startData = ParseContainerStartData(entry.value);
                     MergeContainerHistoryData(historyData, startData);
                     readStartData = true;
                 }
                 else
                 {
                     if (entry.key.suffix.Equals(FinishDataSuffix))
                     {
                         ContainerFinishData finishData = ParseContainerFinishData(entry.value);
                         MergeContainerHistoryData(historyData, finishData);
                         readFinishData = true;
                     }
                 }
             }
         }
         if (!readStartData && !readFinishData)
         {
             return(null);
         }
         if (!readStartData)
         {
             Log.Warn("Start information is missing for container " + containerId);
         }
         if (!readFinishData)
         {
             Log.Warn("Finish information is missing for container " + containerId);
         }
         Log.Info("Completed reading history information of container " + containerId);
         return(historyData);
     }
     catch (IOException e)
     {
         Log.Error("Error when reading history file of container " + containerId, e);
         throw;
     }
     finally
     {
         hfReader.Close();
     }
 }
        /// <exception cref="System.IO.IOException"/>
        public virtual void ContainerStarted(ContainerStartData containerStart)
        {
            ConcurrentMap <ContainerId, ContainerHistoryData> subMap = GetSubMap(containerStart
                                                                                 .GetContainerId().GetApplicationAttemptId());
            ContainerHistoryData oldData = subMap.PutIfAbsent(containerStart.GetContainerId()
                                                              , ContainerHistoryData.NewInstance(containerStart.GetContainerId(), containerStart
                                                                                                 .GetAllocatedResource(), containerStart.GetAssignedNode(), containerStart.GetPriority
                                                                                                     (), containerStart.GetStartTime(), long.MaxValue, null, int.MaxValue, null));

            if (oldData != null)
            {
                throw new IOException("The start information of container " + containerStart.GetContainerId
                                          () + " is already stored.");
            }
        }
 /// <exception cref="System.IO.IOException"/>
 public virtual void ContainerStarted(ContainerStartData containerStart)
 {
     FileSystemApplicationHistoryStore.HistoryFileWriter hfWriter = GetHistoryFileWriter
                                                                        (containerStart.GetContainerId().GetApplicationAttemptId().GetApplicationId());
     System.Diagnostics.Debug.Assert(containerStart is ContainerStartDataPBImpl);
     try
     {
         hfWriter.WriteHistoryData(new FileSystemApplicationHistoryStore.HistoryDataKey(containerStart
                                                                                        .GetContainerId().ToString(), StartDataSuffix), ((ContainerStartDataPBImpl)containerStart
                                                                                                                                         ).GetProto().ToByteArray());
         Log.Info("Start information of container " + containerStart.GetContainerId() + " is written"
                  );
     }
     catch (IOException e)
     {
         Log.Error("Error when writing start information of container " + containerStart.GetContainerId
                       (), e);
         throw;
     }
 }
 private static void MergeContainerHistoryData(ContainerHistoryData historyData, ContainerStartData
                                               startData)
 {
     historyData.SetAllocatedResource(startData.GetAllocatedResource());
     historyData.SetAssignedNode(startData.GetAssignedNode());
     historyData.SetPriority(startData.GetPriority());
     historyData.SetStartTime(startData.GetStartTime());
 }
 /// <exception cref="System.IO.IOException"/>
 public virtual void ContainerStarted(ContainerStartData containerStart)
 {
 }
 public virtual void ContainerStarted(RMContainer container)
 {
     if (historyServiceEnabled)
     {
         dispatcher.GetEventHandler().Handle(new WritingContainerStartEvent(container.GetContainerId
                                                                                (), ContainerStartData.NewInstance(container.GetContainerId(), container.GetAllocatedResource
                                                                                                                       (), container.GetAllocatedNode(), container.GetAllocatedPriority(), container.GetCreationTime
                                                                                                                       ())));
     }
 }
 /// <exception cref="System.IO.IOException"/>
 protected internal virtual void WriteContainerStartData(ContainerId containerId)
 {
     store.ContainerStarted(ContainerStartData.NewInstance(containerId, Resource.NewInstance
                                                               (0, 0), NodeId.NewInstance("localhost", 0), Priority.NewInstance(containerId.GetId
                                                                                                                                    ()), 0));
 }