예제 #1
0
        public JobRegistration RegisterJob(AbstractCommand command, IJobDetail jobDetail, ITrigger trigger)
        {
            if (!JobGroups.ContainsKey(command.SchedulerGroup))
            {
                JobGroups.Add(command.SchedulerGroup, new JobGroup());
            }

            if (JobGroups[command.SchedulerGroup].Registrations.ContainsKey(command.ScheduleId))
            {
                throw new DuplicateScheduledCommandException(command.Name, command.ScheduleId, command.SchedulerGroup);
            }

            var registration = new JobRegistration(command, jobDetail, trigger);

            JobGroups[command.SchedulerGroup].Registrations.Add(command.ScheduleId, registration);
            return(registration);
        }