// Token: 0x0600080D RID: 2061 RVA: 0x000207AC File Offset: 0x0001E9AC public IAsyncResult BeginGetServer(AsyncCallback callback, object asyncState) { if (this.serverLocator != null) { throw new InvalidOperationException("BeginGetServerForDatabase executing in progress."); } this.ResolveMasterServerOrDag(); if (this.masterServer == null) { this.Tracer.TraceError <Guid>((long)this.GetHashCode(), "[MailboxServerLocator.BeginGetServerForDatabase] Cannot find any available mailbox server for database {0}.", this.DatabaseGuid); throw new MailboxServerLocatorException(this.DatabaseGuid.ToString()); } IAsyncResult result2; lock (this.lockObject) { this.stopWatch = Stopwatch.StartNew(); if (this.masterServer.VersionNumber < Server.E15MinVersion || this.SkipServerLocatorQuery || MailboxServerLocator.InjectRemoteForestDownLevelServerException.Value) { MailboxServerLocator.DummyAsyncResult result = new MailboxServerLocator.DummyAsyncResult { AsyncState = asyncState }; if (callback != null) { ThreadPool.QueueUserWorkItem(delegate(object o) { callback(result); }); } this.IsSourceCachedData = false; result2 = result; } else { this.lazyAsyncResult = new LazyAsyncResult(this, asyncState, callback); this.ServerLocatorBeginGetServerList(this.BatchRequest); result2 = this.lazyAsyncResult; } } return(result2); }
// Token: 0x0600080E RID: 2062 RVA: 0x00020900 File Offset: 0x0001EB00 public BackEndServer EndGetServer(IAsyncResult result) { if (result == null) { throw new ArgumentNullException("result"); } lock (this.lockObject) { base.CheckDisposed(); } BackEndServer result2; try { MailboxServerLocator.DummyAsyncResult dummyAsyncResult = result as MailboxServerLocator.DummyAsyncResult; if (dummyAsyncResult != null) { this.CheckDownLevelServerForest(); BackEndServer backEndServer = null; if (this.masterServer.VersionNumber < Server.E14MinVersion || this.SkipServerLocatorQuery) { backEndServer = new BackEndServer(this.masterServer.Fqdn, this.masterServer.VersionNumber); } else { lock (this.lockObject) { backEndServer = this.GetLegacyServerForDatabase(this.DatabaseGuid); } } if (backEndServer != null) { this.AvailabilityGroupServers = new Dictionary <Guid, BackEndServer>(1); this.AvailabilityGroupServers.Add(this.DatabaseGuid, backEndServer); } result2 = backEndServer; } else { lock (this.lockObject) { if (this.serverLocator == null) { throw new InvalidOperationException("BeginGetServerForDatabase() was not executed."); } if (!object.ReferenceEquals(result, this.lazyAsyncResult)) { throw new InvalidOperationException("Calling with the wrong instance of IAsyncResult."); } } this.lazyAsyncResult.InternalWaitForCompletion(); lock (this.lockObject) { if (this.asyncException != null) { this.Tracer.TraceError <Exception>((long)this.GetHashCode(), "[MailboxServerLocator.EndGetServer] Throwing async exception {0}.", this.asyncException); throw this.asyncException; } result2 = this.AvailabilityGroupServers[this.DatabaseGuid]; } } } finally { this.Latency = this.stopWatch.ElapsedMilliseconds; } return(result2); }