Пример #1
0
 public static JobCreatorFactory GetFactory()
 {
     if (_instance == null)
     {
         _instance = new JobCreatorFactory();
     }
     return(_instance);
 }
Пример #2
0
 private TseDownloader()
 {
     this._creatorFactory = JobCreatorFactory.GetFactory();
     this._jobQueue       = new ConcurrentQueue <TseJob>();
     this._doJobTimes     = 0;
     //建立一個thread來執行TseJob,每隔2+N秒(N取決於亂數)會執行一次TseJob
     this._timerThread = new Timer(DoTseJob, DateTime.Now, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, _baseSecond));
     //建立一個thread用來建立TseJob,每隔10秒會建立一個TseJob
     this._creatorThread = new Timer(CreateJob, DateTime.Now, 100, 10000);
 }