public static void CreateJob(TransactionalRequestJob requestJob, ReservationContext reservation)
        {
            BaseJob baseJob;

            lock (MailboxSyncerJobs.syncRoot)
            {
                Guid guid = (requestJob.RequestType == MRSRequestType.Move) ? requestJob.ExchangeGuid : requestJob.RequestGuid;
                baseJob = MailboxSyncerJobs.FindJob(guid, false);
                if (baseJob != null)
                {
                    MrsTracer.Service.Error("Request {0} is already being worked on.", new object[]
                    {
                        guid
                    });
                    return;
                }
                baseJob = MailboxSyncerJobs.ConstructJob(requestJob);
                if (baseJob == null)
                {
                    MrsTracer.Service.Error("Don't know how to process '{0}' request", new object[]
                    {
                        requestJob.RequestType
                    });
                    return;
                }
                baseJob.Initialize(requestJob);
                baseJob.Reservation = reservation;
                MailboxSyncerJobs.activeJobs.Add(guid, baseJob);
                MailboxSyncerJobs.activeJobsIsEmpty.Reset();
            }
            JobScheduler.ScheduleJob(baseJob);
        }
Example #2
0
 public static bool JobIsActive(Guid mailboxGuid)
 {
     CommonUtils.CheckForServiceStopping();
     return(MailboxSyncerJobs.FindJob(mailboxGuid, false) != null);
 }