Exemplo n.º 1
0
        private static void JobStateChangedHandler(object sender, JobEventArgs args)
        {
            BaseJob baseJob = args.Job as BaseJob;

            if (baseJob != null)
            {
                Guid objectGuid = baseJob.RequestJobStoringMDB.ObjectGuid;
                switch (args.State)
                {
                case JobState.Failed:
                case JobState.Finished:
                    baseJob.Disconnect();
                    baseJob.JobCompletedCallback();
                    lock (MailboxSyncerJobs.syncRoot)
                    {
                        MailboxSyncerJobs.activeJobs.Remove(baseJob.GetRequestKeyGuid());
                        ((IDisposable)baseJob).Dispose();
                        if (MailboxSyncerJobs.activeJobs.Count == 0)
                        {
                            MailboxSyncerJobs.activeJobsIsEmpty.Set();
                        }
                    }
                    MRSService.Tickle(baseJob.RequestJobGuid, baseJob.RequestJobStoringMDB.ObjectGuid, MoveRequestNotification.Canceled);
                    break;

                case JobState.Waiting:
                    break;

                default:
                    return;
                }
            }
        }