Exemple #1
0
        private Task Tick(object data)
        {
            counter++;
            logger.Info(data.ToString() + " Tick # " + counter + " RuntimeContext = " + RuntimeContext.Current.ActivationContext.ToString());

            // make sure we run in the right activation context.
            logger.Assert(ErrorCode.Runtime_Error_100146, Equals(context, RuntimeContext.Current.ActivationContext));

            string      name  = (string)data;
            IDisposable timer = null;

            if (name == DefaultTimerName)
            {
                timer = defaultTimer;
            }
            else
            {
                timer = allTimers[(string)data];
            }
            logger.Assert(ErrorCode.Runtime_Error_100146, timer != null);
            if (timer != null && counter > 10000)
            {
                // do not let orphan timers ticking for long periods
                timer.Dispose();
            }

            return(TaskDone.Done);
        }
        private Task Tick(object data)
        {
            counter++;
            logger.Info(data.ToString() + " Tick # " + counter + " RuntimeContext = " + RuntimeContext.Current.ActivationContext.ToString());

            // make sure we run in the right activation context.
            logger.Assert(ErrorCode.Runtime_Error_100146, context == RuntimeContext.Current.ActivationContext);

            string      name  = (string)data;
            IDisposable timer = null;

            if (name == DefaultTimerName)
            {
                timer = defaultTimer;
            }
            else
            {
                timer = allTimers[(string)data];
            }
            logger.Assert(ErrorCode.Runtime_Error_100146, timer != null);
            return(TaskDone.Done);
        }
Exemple #3
0
        /// <summary>
        /// For testing purposes only.
        /// Returns the directory information held by the local silo for the provided grain ID.
        /// The result will be null if no information is held.
        /// </summary>
        /// <param name="grain"></param>
        /// <param name="isPrimary"></param>
        /// <returns></returns>
        public List <ActivationAddress> GetLocalDataForGrain(GrainId grain, out bool isPrimary)
        {
            var primary = CalculateTargetSilo(grain);
            List <ActivationAddress> backupData = HandoffManager.GetHandedOffInfo(grain);

            if (MyAddress.Equals(primary))
            {
                log.Assert(ErrorCode.DirectoryBothPrimaryAndBackupForGrain, backupData == null,
                           "Silo contains both primary and backup directory data for grain " + grain);
                isPrimary = true;
                return(GetLocalDirectoryData(grain));
            }

            isPrimary = false;
            return(backupData);
        }
Exemple #4
0
 private void UnhandledException(ISchedulingContext context, Exception exception)
 {
     logger.Error(ErrorCode.Runtime_Error_100007, String.Format("OutsideRuntimeClient caught an UnobservedException."), exception);
     logger.Assert(ErrorCode.Runtime_Error_100008, context == null, "context should be not null only inside OrleansRuntime and not on the client.");
 }