Exemplo n.º 1
0
 /// <summary>
 /// When an activity gets executed and needs to be finalized, all activity objects that have
 /// the same id need to be finalized too. The Attach methods puts all activities with the
 /// same id to a chain to let the Finish method call the Finish method of each object in the chain.
 /// This method was needed because it is possible that the same activity arrives from different
 /// sources: e.g from messaging, from database or from direct execution.
 /// </summary>
 /// <param name="activity"></param>
 internal void Attach(LuceneIndexingActivity activity)
 {
     if (AttachedActivity != null)
     {
         AttachedActivity.Attach(activity);
     }
     else
     {
         AttachedActivity = activity;
     }
 }
Exemplo n.º 2
0
 internal void WaitFor(LuceneIndexingActivity olderActivity)
 {
     // this method must called from thread safe block.
     if (!this.WaitingFor.Any(x => x.Id == olderActivity.Id))
     {
         this.WaitingFor.Add(olderActivity);
     }
     if (!olderActivity.WaitingForMe.Any(x => x.Id == this.Id))
     {
         olderActivity.WaitingForMe.Add(this);
     }
 }
Exemplo n.º 3
0
 internal bool IsInTree(LuceneIndexingActivity newerActivity)
 {
     return(this.Path.StartsWith(newerActivity.Path, StringComparison.OrdinalIgnoreCase));
 }
Exemplo n.º 4
0
 private static void RemoveDependency(List <LuceneIndexingActivity> dependencyList, LuceneIndexingActivity activity)
 {
     // this method must called from thread safe block.
     dependencyList.RemoveAll(x => x.Id == activity.Id);
 }
Exemplo n.º 5
0
 internal void FinishWaiting(LuceneIndexingActivity olderActivity)
 {
     // this method must called from thread safe block.
     RemoveDependency(this.WaitingFor, olderActivity);
     RemoveDependency(olderActivity.WaitingForMe, this);
 }