Exemplo n.º 1
0
 /// <summary>
 /// 创建下一层时间轮
 /// </summary>
 private void CreateNextWheel()
 {
     if (_nextWheel == null)
     {
         lock (_lock)
         {
             // 槽大小是当前时间轮的大小,起始时间是当前时间轮的指针
             if (_nextWheel == null)
             {
                 _nextWheel = new TimingWheel(_wheelSpan, _slotCount, _currentNeedle, _taskCount, _delayQueue);
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tickSpan">时间槽大小,毫秒</param>
 /// <param name="slotCount">时间槽数量</param>
 /// <param name="startMs">起始时间戳,标识时间轮创建时间</param>
 private TimingWheelTimer(long tickSpan, int slotCount, long startMs)
 {
     _timingWheel = new TimingWheel(tickSpan, slotCount, startMs, _taskCount, _delayQueue);
 }