Exemplo n.º 1
0
 public void Dispose()
 {
     if (_distributeTraceEnable)
     {
         _distributedTraceCall($"准备释放, 当前未完成事务 {_scheduler.QuantityTempTask} 个");
     }
     _scheduler?.Dispose();
     _ib.Dispose();
     if (_distributeTraceEnable)
     {
         _distributedTraceCall($"成功释放");
     }
 }
Exemplo n.º 2
0
        static void IdleSchedulerRun()
        {
            _idleScheduler            = new IdleScheduler.Scheduler(new IdleScheduler.TaskHandlers.TestHandler());
            IdleSchedulerRunStartTime = DateTime.Now;
            IdleSchedulerRunTimes     = 0;
            for (var a = 0; a < 50_0000; a++)
            {
                _idleScheduler.AddTempTask(TimeSpan.FromSeconds(10), () =>
                {
                    Console.Out.WriteLine("Hello QuartzNet...");
                    if (Interlocked.Increment(ref Program.IdleSchedulerRunTimes) == 50_0000)
                    {
                        Console.Out.WriteLine($"IdleScheduler 执行 50w 个任务,耗时:{DateTime.Now.Subtract(Program.IdleSchedulerRunStartTime).TotalMilliseconds}ms");
                        _idleScheduler.Dispose();
                    }
                });
                //_idleScheduler.AddTask($"ajob{a}", $"group{a}", 1, 10);
            }

            Console.Out.WriteLine("OK   Hello QuartzNet...");
        }