public ActiveCopiesCacheProvider() { this.activeCopiesList = new List <DatabaseServerInformation>(); this.serverLocator = ServerLocatorServiceClient.Create("localhost"); this.backgroundRefresh = new Timer((double)ActiveCopiesCacheProvider.DataRefreshIntervalInMilliseconds.Value); this.backgroundRefresh.Elapsed += this.OnBackgroundRefresh; this.backgroundRefresh.Enabled = true; this.Synchronize(); }
protected override void InternalRun() { if (!ReplicationCheckGlobals.ServerLocatorServiceCheckHasRun) { ReplicationCheckGlobals.ServerLocatorServiceCheckHasRun = true; } else { ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ServerLocatorServiceCheck skipping because it has already been run once."); base.Skip(); } if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck)))) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title); base.Skip(); } if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title); base.Skip(); } string text = null; bool flag = false; ServerLocatorServiceClient serverLocatorServiceClient = null; TimeSpan timeSpan = TimeSpan.FromSeconds(5.0); try { serverLocatorServiceClient = ServerLocatorServiceClient.Create(base.ServerName, timeSpan, timeSpan, timeSpan, timeSpan); serverLocatorServiceClient.GetVersion(); flag = true; } catch (ServerLocatorClientException ex) { text = ex.Message; } catch (ServerLocatorClientTransientException ex2) { text = ex2.Message; } finally { if (serverLocatorServiceClient != null) { serverLocatorServiceClient.Dispose(); serverLocatorServiceClient = null; } } ExTraceGlobals.HealthChecksTracer.TraceDebug <string, bool, string>((long)this.GetHashCode(), "ServerLocatorServiceCheck: TestHealth() for server '{0}' returned: healthy={1}, errMsg='{2}'", base.ServerName, flag, text); if (!flag) { base.Fail(Strings.ServerLocatorServiceRequestFailed(base.ServerName, text)); } }
// Token: 0x06000813 RID: 2067 RVA: 0x00020BEC File Offset: 0x0001EDEC private void ServerLocatorBeginGetServerList(bool batchRequest) { this.Tracer.TraceDebug <string>((long)this.GetHashCode(), "[MailboxServerLocator.ServerLocatorBeginGetServerList] Calling ServerLocatorService for on host {0}.", this.masterServer.Fqdn); if (this.serverLocator != null) { this.serverLocator.Dispose(); this.serverLocator = null; } this.serverLocator = ServerLocatorServiceClient.Create(this.masterServer.Fqdn, MailboxServerLocator.ServerLocatorCloseTimeout.Value, MailboxServerLocator.ServerLocatorOpenTimeout.Value, MailboxServerLocator.ServerLocatorReceiveTimeout.Value, MailboxServerLocator.ServerLocatorSendTimeout.Value); this.IsSourceCachedData = batchRequest; if (batchRequest) { this.serverLocator.BeginGetActiveCopiesForDatabaseAvailabilityGroup(new AsyncCallback(this.ServerLocatorAsyncCallback), batchRequest); return; } this.serverLocator.BeginGetServerForDatabase(this.DatabaseGuid, new AsyncCallback(this.ServerLocatorAsyncCallback), batchRequest); }
public void Synchronize() { ExWatson.SendReportOnUnhandledException(delegate() { lock (ActiveCopiesCacheProvider.synchronizeLock) { try { if (!this.serverLocator.IsUsable) { this.serverLocator.Dispose(); this.serverLocator = ServerLocatorServiceClient.Create("localhost"); } GetActiveCopiesForDatabaseAvailabilityGroupParameters getActiveCopiesForDatabaseAvailabilityGroupParameters = new GetActiveCopiesForDatabaseAvailabilityGroupParameters(); getActiveCopiesForDatabaseAvailabilityGroupParameters.CachedData = false; this.activeCopiesList = new List <DatabaseServerInformation>(this.serverLocator.GetActiveCopiesForDatabaseAvailabilityGroupExtended(getActiveCopiesForDatabaseAvailabilityGroupParameters)); } catch (ServerLocatorClientTransientException) { } } }); }