Exemple #1
0
 /// <summary>Remove from schedule an execution. </summary>
 /// <param name="metricExec">to remove</param>
 public void Remove(MetricExec metricExec)
 {
     foreach (var entry in _timeHandleMap)
     {
         entry.Value.Remove(metricExec);
     }
 }
Exemple #2
0
        /// <summary>Adds an execution to the schedule. </summary>
        /// <param name="afterMSec">offset to add at</param>
        /// <param name="execution">execution to add</param>
        public void Add(long afterMSec, MetricExec execution)
        {
            lock (this)
            {
                if (execution == null)
                {
                    throw new ArgumentException("Unexpected parameters : null execution");
                }
                long triggerOnTime           = _currentTime.GetValueOrDefault() + afterMSec;
                IList <MetricExec> handleSet = _timeHandleMap.Get(triggerOnTime);
                if (handleSet == null)
                {
                    handleSet = new List <MetricExec>();
                    _timeHandleMap.Put(triggerOnTime, handleSet);
                }
                handleSet.Add(execution);

                _nearestTime = _timeHandleMap.Keys.First();
            }
        }
Exemple #3
0
 public void Execute(MetricExec execution, MetricExecutionContext executionContext)
 {
     execution.Execute(executionContext);
 }
Exemple #4
0
 public void Execute(MetricExec execution, MetricExecutionContext executionContext)
 {
     _threadPool.Submit(() => execution.Execute(executionContext));
 }