internal TypeManager( SiloAddress myAddr, GrainTypeManager grainTypeManager, ISiloStatusOracle oracle, OrleansTaskScheduler scheduler, TimeSpan refreshClusterMapTimeout, ImplicitStreamSubscriberTable implicitStreamSubscriberTable) : base(Constants.TypeManagerId, myAddr) { if (grainTypeManager == null) throw new ArgumentNullException(nameof(grainTypeManager)); if (oracle == null) throw new ArgumentNullException(nameof(oracle)); if (scheduler == null) throw new ArgumentNullException(nameof(scheduler)); if (implicitStreamSubscriberTable == null) throw new ArgumentNullException(nameof(implicitStreamSubscriberTable)); this.grainTypeManager = grainTypeManager; this.statusOracle = oracle; this.implicitStreamSubscriberTable = implicitStreamSubscriberTable; this.scheduler = scheduler; this.hasToRefreshClusterGrainInterfaceMap = true; this.refreshClusterGrainInterfaceMapTimer = new AsyncTaskSafeTimer( OnRefreshClusterMapTimer, null, TimeSpan.Zero, // Force to do it once right now refreshClusterMapTimeout); }
public void Stop() { if (reportTimer != null) { reportTimer.Dispose(); } reportTimer = null; }
private GrainTimer(Func<object, Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period, string name) { var ctxt = RuntimeContext.Current.ActivationContext; activationData = (ActivationData) RuntimeClient.Current.CurrentActivationData; this.Name = name; this.asyncCallback = asyncCallback; timer = new AsyncTaskSafeTimer( stateObj => TimerTick(stateObj, ctxt), state); this.dueTime = dueTime; timerFrequency = period; previousTickTime = DateTime.UtcNow; totalNumTicks = 0; }
private GrainTimer(IActivationData activationData, Func<object, Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period, string name) { var ctxt = RuntimeContext.CurrentActivationContext; InsideRuntimeClient.Current.Scheduler.CheckSchedulingContextValidity(ctxt); this.activationData = activationData; this.Name = name; this.asyncCallback = asyncCallback; timer = new AsyncTaskSafeTimer( stateObj => TimerTick(stateObj, ctxt), state); this.dueTime = dueTime; timerFrequency = period; previousTickTime = DateTime.UtcNow; totalNumTicks = 0; }
private void DisposeTimer() { var tmp = timer; if (tmp == null) return; Utils.SafeExecute(tmp.Dispose); timer = null; asyncCallback = null; if (activationData != null) activationData.OnTimerDisposed(this); }
public void Dispose() { if (this.reportTimer != null) reportTimer.Dispose(); reportTimer = null; }
internal void Start() { reportTimer = new AsyncTaskSafeTimer(Reporter, null, reportFrequency, reportFrequency); // Start a new fresh timer. }
internal void Start() { reportTimer = new AsyncTaskSafeTimer(loggerFactory.CreateLogger <AsyncTaskSafeTimer>(), Reporter, null, reportFrequency, reportFrequency); // Start a new fresh timer. }
public void Dispose() { if (reportTimer != null) { reportTimer.Dispose(); reportTimer = null; } }