Пример #1
0
        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); 
        }
Пример #2
0
 public void Stop()
 {
     if (reportTimer != null)
     {
         reportTimer.Dispose();
     }
     reportTimer = null;
 }
Пример #3
0
        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;
        }
Пример #4
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;
        }
Пример #5
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);
        }
Пример #6
0
 public void Dispose()
 {
     if (this.reportTimer != null)
         reportTimer.Dispose();
     reportTimer = null;
 }
Пример #7
0
 internal void Start()
 {
     reportTimer = new AsyncTaskSafeTimer(Reporter, null, reportFrequency, reportFrequency); // Start a new fresh timer. 
 }
Пример #8
0
 internal void Start()
 {
     reportTimer = new AsyncTaskSafeTimer(Reporter, null, reportFrequency, reportFrequency); // Start a new fresh timer.
 }
Пример #9
0
 internal void Start()
 {
     reportTimer = new AsyncTaskSafeTimer(loggerFactory.CreateLogger <AsyncTaskSafeTimer>(), Reporter, null, reportFrequency, reportFrequency); // Start a new fresh timer.
 }
Пример #10
0
 public void Dispose()
 {
     if (reportTimer != null)
     {
         reportTimer.Dispose();
         reportTimer = null;
     }
 }