コード例 #1
0
        public static MicroDelayScope Create(MailboxReplicationProxyService mrsProxy, DelayScopeKind kind)
        {
            Guid guid = ConfigBase <MRSConfigSchema> .CurrentContext.DatabaseGuid ?? Guid.Empty;

            if (guid == Guid.Empty && (kind == DelayScopeKind.DbRead || kind == DelayScopeKind.DbWrite))
            {
                kind = DelayScopeKind.CPUOnly;
            }
            switch (kind)
            {
            case DelayScopeKind.CPUOnly:
                return(new MicroDelayScope(mrsProxy, MicroDelayScope.LocalCpuResourcesOnly));

            case DelayScopeKind.DbRead:
                if (mrsProxy.IsE15OrHigher)
                {
                    return(new MicroDelayScope(mrsProxy, new ResourceKey[]
                    {
                        ProcessorResourceKey.Local,
                        new MdbResourceHealthMonitorKey(guid),
                        new DiskLatencyResourceKey(guid)
                    }));
                }
                return(new MicroDelayScope(mrsProxy, new ResourceKey[]
                {
                    ProcessorResourceKey.Local,
                    new MdbResourceHealthMonitorKey(guid)
                }));

            case DelayScopeKind.DbWrite:
                if (mrsProxy.IsE15OrHigher)
                {
                    return(new MicroDelayScope(mrsProxy, new ResourceKey[]
                    {
                        ProcessorResourceKey.Local,
                        new MdbResourceHealthMonitorKey(guid),
                        new MdbReplicationResourceHealthMonitorKey(guid),
                        new MdbAvailabilityResourceHealthMonitorKey(guid),
                        new CiAgeOfLastNotificationResourceKey(guid),
                        new DiskLatencyResourceKey(guid)
                    }));
                }
                return(new MicroDelayScope(mrsProxy, new ResourceKey[]
                {
                    ProcessorResourceKey.Local,
                    new MdbResourceHealthMonitorKey(guid),
                    new LegacyResourceHealthMonitorKey(guid)
                }));
            }
            return(null);
        }
コード例 #2
0
        private MicroDelayScope(MailboxReplicationProxyService mrsProxy, params ResourceKey[] resources)
        {
            this.startedCallProcessingAt = ExDateTime.UtcNow;
            this.resources         = resources;
            this.budget            = StandardBudget.AcquireUnthrottledBudget("MrsProxyBudget", BudgetType.ResourceTracking);
            this.workLoadSettings  = (mrsProxy.IsHighPriority ? CommonUtils.WorkloadSettingsHighPriority : CommonUtils.WorkloadSettings);
            this.skipWLMThrottling = (!ResourceHealthMonitorManager.Active || !TestIntegration.Instance.MicroDelayEnabled || mrsProxy.SkipWLMThrottling || mrsProxy.IsInFinalization);
            bool flag = false;

            try
            {
                if (!this.skipWLMThrottling)
                {
                    ResourceLoadDelayInfo.CheckResourceHealth(this.budget, this.workLoadSettings, this.resources);
                }
                this.budget.StartConnection("MailboxReplicationService.MicroDelayScope.MicroDelayScope");
                this.budget.StartLocal("MailboxReplicationService.MicroDelayScope.MicroDelayScope", default(TimeSpan));
                if (!ActivityContext.IsStarted)
                {
                    this.scope        = ActivityContext.Start(null);
                    this.scope.Action = "MailboxReplicationProxyService";
                    if (OperationContext.Current != null)
                    {
                        this.scope.UpdateFromMessage(OperationContext.Current);
                    }
                    this.scope.UserId = mrsProxy.ExchangeGuid.ToString();
                    if (mrsProxy.ClientVersion != null)
                    {
                        this.scope.ClientInfo = mrsProxy.ClientVersion.ComputerName;
                    }
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    this.SuppressDisposeTracker();
                    if (this.budget != null)
                    {
                        this.budget.Dispose();
                        this.budget = null;
                    }
                    if (this.scope != null)
                    {
                        this.scope.End();
                        this.scope = null;
                    }
                }
            }
        }
コード例 #3
0
 public DataExport(IDataMessage getDataResponseMsg, MailboxReplicationProxyService service)
 {
     this.getDataResponseMsg   = getDataResponseMsg;
     this.nextOpcode           = DataMessageOpcode.None;
     this.nextBuffer           = null;
     this.result               = DataExport.DataExportResult.Done;
     this.exportFailure        = null;
     this.exportThread         = null;
     this.eventDataAvailable   = new AutoResetEvent(false);
     this.eventDataProcessed   = new AutoResetEvent(false);
     this.cancelExport         = false;
     this.service              = service;
     this.lastReturnWasTimeout = false;
     this.storedOpcode         = 0;
     this.storedData           = null;
 }