Esempio n. 1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="timeSourceService">time source provider</param>
 public SchedulingServiceImpl(TimeSourceService timeSourceService)
 {
     _uLock         = LockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _timeHandleMap = new SortedList <long, IDictionary <ScheduleSlot, ScheduleHandle> >();
     _handleSetMap  = new Dictionary <ScheduleHandle, IDictionary <ScheduleSlot, ScheduleHandle> >();
     // initialize time to just before now as there is a check for duplicate external time events
     _currentTime = timeSourceService.GetTimeMillis() - 1;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="timeSourceService">time source provider</param>
 /// <param name="lockManager">The lock manager.</param>
 public SchedulingServiceImpl(TimeSourceService timeSourceService, ILockManager lockManager)
 {
     _uLock         = lockManager.CreateLock(GetType());
     _timeHandleMap = new SortedList <long, IDictionary <long, ScheduleHandle> >();
     _handleSetMap  = new Dictionary <ScheduleHandle, IDictionary <long, ScheduleHandle> >();
     // initialize time to just before now as there is a check for duplicate external time events
     _currentTime = timeSourceService.GetTimeMillis() - 1;
 }
Esempio n. 3
0
        private void AssertTimeWithinTolerance(long TOLERANCE_MILLISECS, TimeSourceService nanos, TimeSourceService millis)
        {
            TimeSourceServiceImpl.IS_SYSTEM_CURRENT_TIME = true;
            long nanosWallClockTime = nanos.GetTimeMillis();

            TimeSourceServiceImpl.IS_SYSTEM_CURRENT_TIME = false;
            long millisWallClockTime = millis.GetTimeMillis();

            long diff = nanosWallClockTime - millisWallClockTime;

            log.Info("diff=" + diff + " between " + nanos + " and " + millis);
            Assert.IsTrue(Math.Abs(diff) < TOLERANCE_MILLISECS, "Diff " + diff + " >= " + TOLERANCE_MILLISECS);
        }
Esempio n. 4
0
        public void Execute()
        {
            if (!_earlier._isCompleted)
            {
                long spinStartTime = _timeSourceService.GetTimeMillis();

                while (!_earlier._isCompleted)
                {
                    Thread.Yield();

                    long spinDelta = _timeSourceService.GetTimeMillis() - spinStartTime;
                    if (spinDelta > _msecTimeout)
                    {
                        Log.Info("Spin wait timeout exceeded in listener dispatch for statement '" + _view.StatementResultService.StatementName + "'");
                        break;
                    }
                }
            }

            _view.Execute();
            _isCompleted = true;

            _earlier = null;
        }