public ICancellable Schedule(IScheduled scheduled, object data, long delayBefore, long interval) => CreateAndStore( scheduled, data, TimeSpan.FromMilliseconds(delayBefore), TimeSpan.FromMilliseconds(interval), true);
public ICancellable ScheduleOnce(IScheduled scheduled, object data, long delayBefore, long interval) => CreateAndStore( scheduled, data, TimeSpan.FromMilliseconds(delayBefore + interval), TimeSpan.FromMilliseconds(Timeout.Infinite), false);
/// <summary> /// Answer a <code>ICancellable</code> for single scheduled notifier. /// </summary> /// <typeparam name="T">The type of data to be sent with each notification.</typeparam> /// <param name="scheduled">The <code>IScheduled<T></code> to receive notification.</param> /// <param name="data">The data to be sent with the notification.</param> /// <param name="delayBefore">The duration before notification interval timing will begin.</param> /// <param name="interval">The duration before the single notification.</param> /// <returns><code>ICancellable</code></returns> public virtual ICancellable ScheduleOnce <T>(IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval) => CreateAndStore( scheduled, data, delayBefore + interval, TimeSpan.FromMilliseconds(Timeout.Infinite), false);
/// <summary> /// Answer a <code>ICancellable</code> for the repeating scheduled notifier. /// </summary> /// <typeparam name="T">The type of data to be sent with each notification.</typeparam> /// <param name="scheduled">The <code>IScheduled<T></code> to receive notification.</param> /// <param name="data">The data to be sent with each notification.</param> /// <param name="delayBefore">The duration before notification interval timing will begin.</param> /// <param name="interval">The duration between each notification.</param> /// <returns><code>ICancellable</code></returns> public virtual ICancellable Schedule <T>(IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval) => CreateAndStore( scheduled, data, delayBefore, interval, true);
public void IntervalSignal(IScheduled <RetryGappedEntries <T> > scheduled, RetryGappedEntries <T> data) { var gappedReader = data.GappedReader; var fillups = gappedReader(data.GappedEntries.GapIds); var nextGappedEntries = data.GappedEntries.FillupWith(fillups); if (!nextGappedEntries.ContainsGaps || !data.MoreRetries) { var eventually = data.GappedEntries.CompletesEventually; if (nextGappedEntries.Count == 1) { // Only one entry has to be returned. eventually.With(nextGappedEntries.GetFirst().OrElse(null !)); } else { eventually.With(nextGappedEntries.SortedLoadedEntries); } } else { var nextData = data.NextRetry(nextGappedEntries); Scheduler.ScheduleOnce(scheduled, nextData, TimeSpan.Zero, data.RetryInterval); } }
public SchedulerTask(IScheduled scheduled, object data, TimeSpan delayBefore, TimeSpan interval, bool repeats) { this.scheduled = scheduled; this.repeats = repeats; hasRun = false; timer = new Timer(new TimerCallback(Tick), data, delayBefore, interval); }
public SchedulerTask(IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval, bool repeats) { _scheduled = scheduled; _data = data; _repeats = repeats; _hasRun = false; _timer = new Timer(Tick, null, delayBefore, interval); }
public void IntervalSignal(IScheduled <object> scheduled, object data) { if (!executed.Get()) { timedOut.Set(true); HasFailedValue.Set(true); } }
public SchedulerTask(IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval, bool repeats) { this.scheduled = scheduled; this.data = data; this.repeats = repeats; hasRun = false; timer = new Timer(Tick, null, delayBefore, interval); }
public void IntervalSignal(IScheduled <object?> scheduled, object?data) { if (!executed.Get() && !TimedOut.Get()) { TimedOut.Set(true); Parent?.TimedOut.Set(true); HasFailedValue.Set(true); } }
public SchedulerTask(IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval, bool repeats) { this.scheduled = scheduled; this.data = data; this.repeats = repeats; this.interval = interval; hasRun = false; // for scheduled in intervals and scheduled once we fire only the first time. timer = new Timer(Tick, null, delayBefore, TimeSpan.FromMilliseconds(Timeout.Infinite)); }
//========================================= // Scheduled //========================================= public void IntervalSignal(IScheduled <object> scheduled, object data) { try { ProbeChannel(); } catch (Exception e) { Logger.Error($"Failed to ProbeChannel for {_name} because: {e.Message}", e); } }
private SchedulerTask CreateAndStore( IScheduled scheduled, object data, TimeSpan delayBefore, TimeSpan interval, bool repeats) { var task = new SchedulerTask(scheduled, data, delayBefore, interval, repeats); tasks.Add(task); return(task); }
public void IntervalSignal(IScheduled scheduled, object data) { if (!actor.IsStopped) { Action <IScheduled> consumer = actor => actor.IntervalSignal(scheduled, data); mailbox.Send(new LocalMessage <IScheduled>(actor, consumer, RepresentationIntervalSignal1)); } else { actor.DeadLetters.FailedDelivery(new DeadLetter(actor, RepresentationIntervalSignal1)); } }
public override ICancellable ScheduleOnce <T>(IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval) { var t = new Thread(() => { Thread.Sleep(delayBefore + interval); scheduled.IntervalSignal(scheduled, data); }); t.Start(); return(new NoOpCancellable()); }
private SchedulerTask <T> CreateAndStore <T>( IScheduled <T> scheduled, T data, TimeSpan delayBefore, TimeSpan interval, bool repeats) { var task = new SchedulerTask <T>(scheduled, data, delayBefore, interval, repeats); _tasks.Push(task); return(task); }
public void IntervalSignal(IScheduled <object> scheduled, object data) { if (IsOutcomeKnown || executables.IsReadyToExecute) { // do nothing } else { timedOut.Set(true); Failed(); } }
public void IntervalSignal(IScheduled <int> scheduled, int data) { if (_count < _maximum) { Schedule(); } else { _completesEventually.With(_count); SelfAs <IStoppable>().Stop(); } }
public void IntervalSignal(IScheduled <T> scheduled, T data) { if (!actor.IsStopped) { Action <IScheduled <T> > consumer = x => x.IntervalSignal(scheduled, data); if (mailbox.IsPreallocated) { mailbox.Send(actor, consumer, null, RepresentationIntervalSignal1); } else { mailbox.Send(new LocalMessage <IScheduled <T> >(actor, consumer, RepresentationIntervalSignal1)); } } else { actor.DeadLetters.FailedDelivery(new DeadLetter(actor, RepresentationIntervalSignal1)); } }
public void IntervalSignal(IScheduled <object> scheduled, object data) { if (!actor.IsStopped) { Action <IAttributesAgent> consumer = x => x.IntervalSignal(scheduled, data); if (mailbox.IsPreallocated) { mailbox.Send(actor, consumer, null, IntervalSignalRepresentation7); } else { mailbox.Send(new LocalMessage <IAttributesAgent>(actor, consumer, IntervalSignalRepresentation7)); } } else { actor.DeadLetters.FailedDelivery(new DeadLetter(actor, IntervalSignalRepresentation7)); } }
public void IntervalSignal(IScheduled <object> scheduled, object data) { if (!_actor.IsStopped) { Action <IClientConsumer> consumer = actor => actor.IntervalSignal(scheduled, data); if (_mailbox.IsPreallocated) { _mailbox.Send(_actor, consumer, null, IntervalSignalRepresentation4); } else { _mailbox.Send(new LocalMessage <IClientConsumer>(_actor, consumer, IntervalSignalRepresentation4)); } } else { _actor.DeadLetters?.FailedDelivery(new DeadLetter(_actor, IntervalSignalRepresentation4)); } }
public void IntervalSignal(IScheduled <object> scheduled, object data) { Logger.Debug("Started eviction routine"); var currentProcess = Process.GetCurrentProcess(); var fillRatio = currentProcess.PrivateMemorySize64 / (float)currentProcess.WorkingSet64; if (fillRatio >= _config.FillRatioHigh) { Logger.Debug($"Memory fill ratio {fillRatio} exceeding watermark ({_config.FillRatioHigh})"); var evicted = _directory.EvictionCandidates(_config.LruThresholdMillis) .Where(actor => actor.LifeCycle.Evictable.Stop(_config.LruThresholdMillis)) .Select(actor => actor.Address) .ToArray(); Logger.Debug($"Evicted {evicted.Length} actors :: {evicted}"); } else { Logger.Debug($"Memory fill ratio {fillRatio} was below watermark ({_config.FillRatioHigh})"); } }
public void IntervalSignal(IScheduled <T> scheduled, T data) { if (!_actor.IsStopped) { Action <IScheduled <T> > cons1513252312 = __ => __.IntervalSignal(scheduled, data); if (_mailbox.IsPreallocated) { _mailbox.Send(_actor, cons1513252312, null, IntervalSignalRepresentation1); } else { _mailbox.Send(new LocalMessage <IScheduled <T> >(_actor, cons1513252312, IntervalSignalRepresentation1)); } } else { _actor.DeadLetters?.FailedDelivery(new DeadLetter(_actor, IntervalSignalRepresentation1)); } }
//========================== // Scheduled //========================== public void IntervalSignal(IScheduled <object> scheduled, object data) { var currentTime = DateTimeHelper.CurrentTimeMillis(); var expiredKeys = new List <string>(); foreach (var projectionId in _confirmables.Keys) { var confirmable = _confirmables[projectionId]; if (confirmable.ExpiresBy <= currentTime) { expiredKeys.Add(projectionId); } } foreach (var projectionId in expiredKeys) { Logger.Info($"Removing expired confirmable: {projectionId}"); _confirmables.Remove(projectionId); } }
//========================================= // Scheduled //========================================= public void IntervalSignal(IScheduled <IntervalType> scheduled, IntervalType data) { if (_stopped) { return; } if (!_leader) { return; } switch (data) { case IntervalType.Processing: _publisher.ProcessChannel(); break; case IntervalType.Publishing: _publisher.SendAvailability(); PublishAllServices(); break; } }
public void IntervalSignal(IScheduled <object> scheduled, object data) { var message = $"{ErrorMessage} IntervalSignal()"; Logger.Error(message, new NotSupportedException(message)); }
public void IntervalSignal(IScheduled <object> scheduled, object data) => _channel.ProbeChannel();
//========================================= // Scheduled //========================================= public void IntervalSignal(IScheduled <object> scheduled, object data) { _reader.ProbeChannel(); }
public void IntervalSignal(IScheduled <object> scheduled, object data) { }
public void IntervalSignal(IScheduled <object?> scheduled, object?data) => DispatchUnconfirmed();