Beispiel #1
0
 /// <summary>Adds a named node with a specified progress weightage to the tree.</summary>
 public virtual Org.Apache.Hadoop.Util.Progress AddPhase(string status, float weightage
                                                         )
 {
     Org.Apache.Hadoop.Util.Progress phase = AddPhase(weightage);
     phase.SetStatus(status);
     return(phase);
 }
Beispiel #2
0
 internal virtual void SetParent(Org.Apache.Hadoop.Util.Progress parent)
 {
     lock (this)
     {
         this.parent = parent;
     }
 }
Beispiel #3
0
 /// <summary>Adds a new phase.</summary>
 /// <remarks>Adds a new phase. Caller needs to set progress weightage</remarks>
 private Org.Apache.Hadoop.Util.Progress AddNewPhase()
 {
     lock (this)
     {
         Org.Apache.Hadoop.Util.Progress phase = new Org.Apache.Hadoop.Util.Progress();
         phases.AddItem(phase);
         phase.SetParent(this);
         return(phase);
     }
 }
Beispiel #4
0
 /// <summary>Adds a node to the tree.</summary>
 /// <remarks>Adds a node to the tree. Gives equal weightage to all phases</remarks>
 public virtual Org.Apache.Hadoop.Util.Progress AddPhase()
 {
     lock (this)
     {
         Org.Apache.Hadoop.Util.Progress phase = AddNewPhase();
         // set equal weightage for all phases
         progressPerPhase           = 1.0f / phases.Count;
         fixedWeightageForAllPhases = true;
         return(phase);
     }
 }
Beispiel #5
0
 /// <summary>Returns the overall progress of the root.</summary>
 public virtual float Get()
 {
     lock (this)
     {
         // this method probably does not need to be synchronized as getInternal() is
         // synchronized and the node's parent never changes. Still, it doesn't hurt.
         Org.Apache.Hadoop.Util.Progress node = this;
         while (node.GetParent() != null)
         {
             // find the root
             node = parent;
         }
         return(node.GetInternal());
     }
 }
Beispiel #6
0
 /// <summary>Adds a node with a specified progress weightage to the tree.</summary>
 public virtual Org.Apache.Hadoop.Util.Progress AddPhase(float weightage)
 {
     lock (this)
     {
         Org.Apache.Hadoop.Util.Progress phase = new Org.Apache.Hadoop.Util.Progress();
         progressWeightagesForPhases.AddItem(weightage);
         phases.AddItem(phase);
         phase.SetParent(this);
         // Ensure that the sum of weightages does not cross 1.0
         float sum = 0;
         for (int i = 0; i < phases.Count; i++)
         {
             sum += progressWeightagesForPhases[i];
         }
         if (sum > 1.0)
         {
             Log.Warn("Sum of weightages can not be more than 1.0; But sum = " + sum);
         }
         return(phase);
     }
 }