/// <summary> /// Raises the PackageFinished event /// </summary> /// <param name="e">the arguments of the finished event</param> protected virtual void OnPackageFinished(PackageFinishedEventArgs e) { if (PackageFinished != null) { PackageFinished(this, e); } }
/// <summary> /// Processes the PackageProcessed event and re-raises it for this clients clients /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PackageProcessed(object sender, PackageFinishedEventArgs e) { if (e.Package.RequestingSystem == localSystemIdentifier) { TLocalEventArgs args = GetEventData((TPackage)e.Package, (from t in e.Tasks select(TTask) t).ToArray()); OnPackageProcessed(args); client.CallRemoteMethod(remoteObjectName, ParallellResources.ParallelMethod_CommitTaskDoneRecieved, new object[] { localSystemIdentifier, e.Package.Id }); } }
/// <summary> /// Handles the PackageFinished event of a processed package /// </summary> /// <param name="sender">the event-sender</param> /// <param name="e">arguments about the finished package</param> private void PackageFinished(object sender, PackageFinishedEventArgs e) { e.Package.PackageFinished -= PackageFinished; e.Package.DemandForRequeue -= DemandForRequeue; lock (triggeredEvents) { triggeredEvents.Add(new PackageFinishedEventArgsReTriggerContainer { Args = e, LastTrigger = DateTime.Now }); } if (PackageProcessed != null) { PackageProcessed(this, e); } bool collect; lock (this) { collect = collectStats; } if (collect) { ProcessedPackageInfo info = new ProcessedPackageInfo(); info.Duration = DateTime.Now.Subtract(e.Package.CreationTime).TotalSeconds; info.ItemCount = e.Tasks.Length; info.SuccessCount = (from i in e.Tasks where i.Success select i).Count(); info.FailCount = (from i in e.Tasks select i.FailCount).Sum(); CollectSpecialPackageStatistics(e); statData.ProcessingData.Add(info); } lock (workingPackages) { workingPackages.Remove((TPackage)e.Package); } }
/// <summary> /// Enables a derived class to collect further statistic information after the general statistic information was collected /// </summary> /// <param name="packageFinishedEventArgs">information about a finished package</param> protected virtual void CollectSpecialPackageStatistics(PackageFinishedEventArgs packageFinishedEventArgs) { }