當前位置: 首頁>>代碼示例>>C#>>正文


C# Impl.StdSchedulerFactory類代碼示例

本文整理匯總了C#中Quartz.Impl.StdSchedulerFactory的典型用法代碼示例。如果您正苦於以下問題:C# StdSchedulerFactory類的具體用法?C# StdSchedulerFactory怎麽用?C# StdSchedulerFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StdSchedulerFactory類屬於Quartz.Impl命名空間,在下文中一共展示了StdSchedulerFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: QuartzService

 public QuartzService()
 {
     InitializeComponent();
     logger = LogManager.GetLogger(GetType());
     ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
     scheduler = schedulerFactory.GetScheduler();
 }
開發者ID:modulexcite,項目名稱:Quartz.net.James,代碼行數:7,代碼來源:QuartzService.cs

示例2: TestMethod1

        public void TestMethod1()
        {
            XmlConfigurator.Configure();

            log.Info("------- Initializing ----------------------");
            // First we must get a reference to a scheduler
            ISchedulerFactory sf = new StdSchedulerFactory();
            IScheduler sched = sf.GetScheduler();

            // define the job and tie it to our HelloJob class
            IJobDetail job = JobBuilder.Create<MyJob>()
                .WithIdentity("MyJob")
                .Build();

            // Trigger the job to run on the next round minute
            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity("MyTrigger")
                .WithCronSchedule("0 0/5 * * * ?")
                .Build();

            // Tell quartz to schedule the job using our trigger
            sched.ScheduleJob(job, trigger);

            // Start up the scheduler (nothing can actually run until the
            // scheduler has been started)
            sched.Start();
            sched.Shutdown();
            Thread.Sleep(300 * 1000);
        }
開發者ID:Jacobeom,項目名稱:git-first,代碼行數:29,代碼來源:UnitTest2.cs

示例3: OnStart

        protected override void OnStart(string[] args)
        {
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter("E:\\log.txt", true))
            {
                sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "start.");
            }

            ISchedulerFactory schedFact = new StdSchedulerFactory();
            // get a scheduler
            IScheduler sched = schedFact.GetScheduler();
            sched.Start();

            // define the job and tie it to our HelloJob class
            IJobDetail job = JobBuilder.Create<HelloWorld>()
                .WithIdentity("myJob", "group1")
                .Build();

            //ITrigger trigger = TriggerBuilder.Create()
            //  .WithIdentity("myTrigger", "group1")
            //  .StartNow()
            //  .WithSimpleSchedule(x => x
            //      .WithIntervalInHours(1)
            //      .RepeatForever())
            //  .Build();
            ITrigger trigger = TriggerBuilder.Create()
            .WithIdentity("myTrigger", "group1")
            .WithCronSchedule("0/5 * * * * ?")
            .ForJob("myJob", "group1")
            .Build();
            sched.ScheduleJob(job, trigger);
        }
開發者ID:TGHGH,項目名稱:MesDemo,代碼行數:31,代碼來源:ServiceHr.cs

示例4: JobSchedule

        public JobSchedule()
        {
            var schedFact = new StdSchedulerFactory();

            sched = schedFact.GetScheduler();
            sched.Start();
        }
開發者ID:nexbit,項目名稱:Brisebois.WindowsAzure,代碼行數:7,代碼來源:JobSchedule.cs

示例5: OnStart

        protected override void OnStart(string[] args)
        {
            logger.Log(LogLevel.Info, String.Format("Starting Open Payments Processor"));

            // construct a scheduler factory
            ISchedulerFactory schedFact = new StdSchedulerFactory();

            IScheduler sched = schedFact.GetScheduler();
            Context ctx = new Context();

            JobDetail jobDetail = new JobDetail("myJob", null, typeof(ProcessOpenPaymentJob));

            Trigger trigger = TriggerUtils.MakeDailyTrigger(5, 00);

            trigger.StartTimeUtc = DateTime.UtcNow;
            trigger.Name = "myTrigger1";
            sched.ScheduleJob(jobDetail, trigger);

            try
            {
                logger.Log(LogLevel.Info, String.Format("Starting Scheduler"));
                sched.Start();
            }
            catch (Exception ex)
            {
                logger.Log(LogLevel.Info, String.Format("Exception Starting Scheduler {0}", ex.Message));
                throw;
            }
        }
開發者ID:SomeHero,項目名稱:SocialPayments,代碼行數:29,代碼來源:Service1.cs

示例6: TestFactoryCanBeUsedWithEmptyProperties

 public Task TestFactoryCanBeUsedWithEmptyProperties()
 {
     var props = new NameValueCollection();
     props["quartz.serializer.type"] = TestConstants.DefaultSerializerType;
     StdSchedulerFactory factory = new StdSchedulerFactory(props);
     return factory.GetScheduler();
 }
開發者ID:jvilalta,項目名稱:quartznet,代碼行數:7,代碼來源:StdSchedulerFactoryTest.cs

示例7: Main

 static void Main(string[] args)
 {
     var factory = new StdSchedulerFactory();
     var scheduler = factory.GetScheduler();
     scheduler.Start();
     while (!scheduler.IsStarted)
     {
         Console.WriteLine("Waiting for scheduler to start.");
         Thread.Sleep(1000);
     }
     Console.WriteLine("IsStarted={0}", scheduler.IsStarted);
     Console.WriteLine("SchedulerInstanceId={0}", scheduler.SchedulerInstanceId);
     Console.WriteLine("SchedulerName={0}", scheduler.SchedulerName);
     Console.WriteLine("The scheduler is running. Press any key to stop");
     Console.ReadKey();
     Console.WriteLine("Shutting down scheduler");
     scheduler.Shutdown(false);
     while (!scheduler.IsShutdown)
     {
         Console.WriteLine("Waiting for scheduler to shutdown.");
         Thread.Sleep(1000);
     }
     Console.WriteLine("IsShutdown={0}", scheduler.IsShutdown);
     Console.WriteLine("The scheduler has been shutdown.");
 }
開發者ID:aytacozkan,項目名稱:QuartzNetBook,代碼行數:25,代碼來源:Program.cs

示例8: Main

        static void Main(string[] args)
        {
            try
            {
                Console.Title = "QMail";
                Console.ForegroundColor = ConsoleColor.White;
                ISchedulerFactory sf = new StdSchedulerFactory();
                Scheduler = sf.GetScheduler();
                new TskInspectDetailJobTrigger();
                Scheduler.Start();

                for (var i = 0; i < 10; i++) {
                    Console.WriteLine();
                }

                Console.ForegroundColor = ConsoleColor.Yellow;

                Console.WriteLine("       ---------------------------------------------------");
                Console.WriteLine("       ...................QMail已啟動......................");
                Console.WriteLine("       ...................請不要關閉此窗口.................");
                Console.WriteLine("       ---------------------------------------------------");
                for (var i = 0; i < 10; i++)
                {
                    Console.WriteLine();
                }
                Console.ReadLine();
            }
            catch (Exception e) {
                LogUtil.Logger.Error(e.Message);
            }
        }
開發者ID:shentianyi,項目名稱:ifDataHouse,代碼行數:31,代碼來源:QmailRunner.cs

示例9: TaskPoolManager

 /// <summary>
 /// 靜態初始化
 /// </summary>
 static TaskPoolManager()
 {
     _taskpoolmanager = new TaskPoolManager();
     ISchedulerFactory sf = new StdSchedulerFactory();
     _sched = sf.GetScheduler();
     _sched.Start();
 }
開發者ID:zeus911,項目名稱:Dyd.BaseService.TaskManager,代碼行數:10,代碼來源:TaskPoolManager.cs

示例10: Scheduler

 static Scheduler()
 {
     ISchedulerFactory schedFact = new StdSchedulerFactory();
     QuartzSheduler = schedFact.GetScheduler();
     QuartzSheduler.Start();
     items = new List<Item>();
 }
開發者ID:Aestek,項目名稱:IrisMailer,代碼行數:7,代碼來源:Scheduler.cs

示例11: Main

        static void Main(string[] args)
        {
            ISchedulerFactory sf = new StdSchedulerFactory();
            IScheduler sched = sf.GetScheduler();

            IScheduler sched1 = sf.GetScheduler();

            JobDetail job = new JobDetail("job1","group1",typeof(SimpleJob));

            //DateTime runtime = TriggerUtils.GetEvenMinuteDate(DateTime.UtcNow);//下一分鍾

            //DateTime runtime = TriggerUtils.GetNextGivenSecondDate(null, 15);//15秒後

            //每一秒運行一次 重複十次 開始時間為now 結束時間為null
            //SimpleTrigger trigger = new SimpleTrigger("trigger1", "gropp1", "job1", "group1", DateTime.UtcNow, null, 10, TimeSpan.FromSeconds(10));

            SimpleTrigger trigger = new SimpleTrigger("trigger1",
                                "gropp1",
                                DateTime.UtcNow,
                                null,
                                SimpleTrigger.RepeatIndefinitely,
                                TimeSpan.FromSeconds(1));

            sched.ScheduleJob(job,trigger);

            LogManager.GetLogger(typeof(Program)).Info("開始循環,每10秒運行一次,重複10次");

            sched.Start();

            //Thread.Sleep(90 * 1000);
        }
開發者ID:Angliy,項目名稱:DevFx,代碼行數:31,代碼來源:Program.cs

示例12: Should_be_possible_to_reschedule_the_collectRequest_that_was_not_collect

        public void Should_be_possible_to_reschedule_the_collectRequest_that_was_not_collect()
        {
            var fakeSession = DataProvider.GetSession();
            var package1 = new CollectRequestFactory().CreateCollectRequest(fakeSession);
            var collectRequest = package1.Item2;
            this.SaveCollectRequest(collectRequest);
            var package2 = new CollectRequestFactory().CreateCollectRequest(fakeSession);
            var otherCollectRequest = package2.Item2;
            this.SaveCollectRequest(otherCollectRequest);
            package1.Item1.ScheduleInformation.ExecutionDate.AddSeconds(100);
            package2.Item1.ScheduleInformation.ExecutionDate.AddSeconds(100);
            var fakeRepository = new CollectRequestRepository(DataProvider);
            var scheduler = new StdSchedulerFactory().GetScheduler();
            var scheduleController = new ScheduleController(scheduler);
            scheduleController.TypeOfExecutionJob = typeof(TestJob);
            

            scheduleController.ReScheduleCollectRequests(
                fakeSession, 
                new[] { collectRequest, otherCollectRequest }, 
                fakeRepository);

            
            Assert.AreEqual(2, scheduleController.GetNumberOfCollectRequestScheduled(), "the number of collectRequest schedule is not expected");
            scheduler.Shutdown();
        }
開發者ID:jonaslsl,項目名稱:modSIC,代碼行數:26,代碼來源:SchedulerControllerTest.cs

示例13: StartSample

        public void StartSample()
        {
            // construct a scheduler factory
            ISchedulerFactory schedFact = new StdSchedulerFactory();

            // get a scheduler
            IScheduler sched = schedFact.GetScheduler();
            sched.Start();

            // define the job and tie it to our HelloJob class
            JobDataMap newJobDataMap = new JobDataMap {{"myStateData", new List<DateTimeOffset>()}};

            IJobDetail job = JobBuilder.Create<StateJob>()
                .WithIdentity("myJob", "group1")
                .SetJobData(newJobDataMap)
                .Build();

            // Trigger the job to run now, and then every 5 seconds
            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity("myTrigger", "group1")
                .StartNow()
                .WithSimpleSchedule(x => x
                    .WithIntervalInSeconds(5)
                    .RepeatForever())
                .Build();

            sched.ScheduleJob(job, trigger);
        }
開發者ID:constructor-igor,項目名稱:TechSugar,代碼行數:28,代碼來源:StateExecuter.cs

示例14: InitScheduler

        public static void InitScheduler(String link)
        {
            if (rootPath != null)
                return;
            rootPath = link;
            ISchedulerFactory schedFact = new StdSchedulerFactory();
            Scheduler = schedFact.GetScheduler();
            Scheduler.Start();
            IJobDetail jobDetail = JobBuilder.Create<PhotoNotifyJob>().WithIdentity("PhotoNotificationJob").Build();
            jobDetail.JobDataMap.Add("path", rootPath);
            //Wystartuj jak najwczesniej, o godzinie 2:00 rano
            DateTime startAt = DateTime.Today;

            startAt = startAt.AddHours(2);
            if (startAt < DateTime.Now) //jesli juz minela godzina 2, wystartuj nastepnego dnia
                startAt = startAt.AddDays(1);

            ITrigger trigger2 = (ISimpleTrigger)TriggerBuilder.Create()
                                           .WithIdentity("trigger")
                                           .StartAt(startAt) // wystartuj scheduler o zadanej godzinie
                                           .WithSimpleSchedule(x => x.WithIntervalInHours(24).RepeatForever()) //odpalaj notyfikacje co 24h, bez limitu powtorzen
                                           .Build();
            DateTimeOffset ft = Scheduler.ScheduleJob(jobDetail, trigger2);
            System.Diagnostics.Debug.WriteLine(jobDetail.Key + " has been scheduled to run at: " + ft);
        }
開發者ID:qbajas,項目名稱:PhotoHistory,代碼行數:25,代碼來源:SchedulerManager.cs

示例15: Scheduler

 private Scheduler()
 {
     ISchedulerFactory schedFact = new StdSchedulerFactory();
     this._sched = schedFact.GetScheduler();
     // Start up the scheduler (nothing can actually run until the scheduler has been started)
     this._sched.Start();
 }
開發者ID:icotting,項目名稱:Phocalstream,代碼行數:7,代碼來源:Scheduler.cs


注:本文中的Quartz.Impl.StdSchedulerFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。