Exemplo n.º 1
0
        /// <summary>
        /// Don't use this method. It is used by QueuedJob's Execute().
        /// </summary>
        public void ScheduleNext()
        {
            lock (queueLock)
            {
                if (queue.Count > 0)
                {
                    QueuedJobDetail queuedJobDetail = queue.Dequeue();

                    JobDetail jobDetail = new JobDetail("QueueJob" + counter, null, queuedJobDetail.JobType);
                    jobDetail.Volatile = true;

                    jobDetail.JobDataMap             = queuedJobDetail.JobDataMap;
                    jobDetail.JobDataMap["JobQueue"] = this;

                    Trigger trigger = new SimpleTrigger("QueueJobTrigger" + counter, null, queuedJobDetail.StartTime);

                    scheduler.ScheduleJob(jobDetail, trigger);

                    counter++;

                    scheduled = true;

                    return;
                }

                scheduled = false;
            }
        }
Exemplo n.º 2
0
        public void Enqueue(QueuedJobDetail queuedJobDetail)
        {
            lock (queueLock)
            {
                Console.WriteLine("[" + name + "] enqueue " + queuedJobDetail.JobType);
                queue.Enqueue(queuedJobDetail);

                if (!scheduled)
                    ScheduleNext();
            }
        }
Exemplo n.º 3
0
        public void Enqueue(QueuedJobDetail queuedJobDetail)
        {
            lock (queueLock)
            {
                Console.WriteLine("[" + name + "] enqueue " + queuedJobDetail.JobType);
                queue.Enqueue(queuedJobDetail);

                if (!scheduled)
                {
                    ScheduleNext();
                }
            }
        }