internal static ThrottlingPolicy ReadThrottlingPolicyFromAD(IConfigurationSession session, object id, Func <IConfigurationSession, object, ThrottlingPolicy> getPolicy) { ThrottlingPolicy policy = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { session.SessionSettings.IsSharedConfigChecked = true; policy = getPolicy(session, id); }); if (!adoperationResult.Succeeded && adoperationResult.Exception != null) { ThrottlingPolicyCache.Tracer.TraceError <string, string, object>(0L, "Encountered exception reading throttling policy. Exception Class: {0}, Message: {1}, Key: {2}", adoperationResult.Exception.GetType().FullName, adoperationResult.Exception.Message, id); } if (policy != null) { ValidationError[] array = policy.Validate(); if (array != null && array.Length > 0) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_FailedToReadThrottlingPolicy, id.ToString(), new object[] { id, array[0].Description }); policy = null; } } return(policy); }
// Token: 0x060072B9 RID: 29369 RVA: 0x0017BC24 File Offset: 0x00179E24 internal override IThrottlingPolicy InternalLookup() { ExchangeConfigurationUnit cu = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { PartitionId partitionIdByAcceptedDomainName = ADAccountPartitionLocator.GetPartitionIdByAcceptedDomainName(this.principal.DelegatedOrganization); if (partitionIdByAcceptedDomainName != null) { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsPartitionId(partitionIdByAcceptedDomainName); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 86, "InternalLookup", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\throttling\\DelegatedPrincipalBudgetKey.cs"); tenantConfigurationSession.SessionSettings.IsSharedConfigChecked = true; cu = tenantConfigurationSession.GetExchangeConfigurationUnitByNameOrAcceptedDomain(this.principal.DelegatedOrganization); } if (cu == null) { throw new CannotResolveTenantNameException(DirectoryStrings.CannotResolveTenantNameByAcceptedDomain(this.principal.DelegatedOrganization)); } }); if (!adoperationResult.Succeeded) { ExTraceGlobals.ClientThrottlingTracer.TraceError <string, string, Exception>((long)this.GetHashCode(), "[DelegatedPrincipalBudgetKey.Lookup] Failed to find Delegated Organization: '{0}' for user '{1}', using global throttling policy. Exception: '{2}'", this.principal.DelegatedOrganization, this.principal.UserId, adoperationResult.Exception); return(ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy()); } OrganizationId orgId = cu.OrganizationId; if (cu.SupportedSharedConfigurations.Count > 0) { SharedConfiguration sharedConfig = null; adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { sharedConfig = SharedConfiguration.GetSharedConfiguration(cu.OrganizationId); }); if (!adoperationResult.Succeeded) { ExTraceGlobals.ClientThrottlingTracer.TraceError <OrganizationId, Exception>((long)this.GetHashCode(), "[DelegatedPrincipalBudgetKey.Lookup] Failed to get Shared Configuration Organization: '{0}', using global throttling policy. Exception: '{1}'", cu.OrganizationId, adoperationResult.Exception); return(ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy()); } if (sharedConfig != null) { orgId = sharedConfig.SharedConfigId; } } return(base.ADRetryLookup(delegate { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(orgId); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 149, "InternalLookup", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\throttling\\DelegatedPrincipalBudgetKey.cs"); tenantOrTopologyConfigurationSession.SessionSettings.IsSharedConfigChecked = true; ThrottlingPolicy organizationThrottlingPolicy = tenantOrTopologyConfigurationSession.GetOrganizationThrottlingPolicy(orgId, false); if (organizationThrottlingPolicy == null) { ExTraceGlobals.ClientThrottlingTracer.TraceError <string, string>((long)this.GetHashCode(), "[DelegatedPrincipalBudgetKey.Lookup] Failed to find Default Throttling Policy for '{0}\\{1}', using global throttling policy", this.principal.DelegatedOrganization, this.principal.UserId); return ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy(); } return organizationThrottlingPolicy.GetEffectiveThrottlingPolicy(true); })); }
// Token: 0x06000356 RID: 854 RVA: 0x000121D0 File Offset: 0x000103D0 public static ADOperationResult TryRegisterChangeNotification <T>(Func <ADObjectId> baseDNGetter, ADNotificationCallback callback, object context, int retryCount, out ADNotificationRequestCookie cookie) where T : ADConfigurationObject, new() { cookie = null; ADNotificationRequestCookie returnedCookie = cookie; ADOperationResult result = ADNotificationAdapter.TryRunADOperation(delegate() { ADObjectId baseDN = (baseDNGetter == null) ? null : baseDNGetter(); object wrappedContext; ADNotificationAdapter.CreateWrappedContextForRegisterChangeNotification(ref baseDN, callback, context, out wrappedContext); returnedCookie = ADNotificationAdapter.RegisterChangeNotification <T>(baseDN, wrappedContext, false, 0); }, retryCount); cookie = returnedCookie; return(result); }
protected internal IThrottlingPolicy ADRetryLookup(Func <IThrottlingPolicy> policyLookup) { IThrottlingPolicy policy = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { policy = policyLookup(); }); if (!adoperationResult.Succeeded) { ExTraceGlobals.ClientThrottlingTracer.TraceError <Exception>((long)this.GetHashCode(), "[LookupBudgetKey.ADRetryLookup] Failed to lookup throttling policy. Failed with exception '{0}'", adoperationResult.Exception); return(ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy()); } return(policy); }
// Token: 0x06000364 RID: 868 RVA: 0x00012880 File Offset: 0x00010A80 public static bool TryReadConfigurationPaged <T>(ADConfigurationReader <ADPagedReader <T> > configurationReader, ADConfigurationProcessor <T> configurationProcessor, int retryCount, out ADOperationResult operationStatus) where T : IConfigurable, new() { if (configurationProcessor == null) { throw new ArgumentNullException("configurationProcessor"); } ADPagedReader <T> pagedReader; if (!ADNotificationAdapter.TryReadConfiguration <ADPagedReader <T> >(configurationReader, out pagedReader, retryCount, out operationStatus)) { return(false); } IEnumerator <T> enumerator = null; operationStatus = ADNotificationAdapter.TryRunADOperation(delegate() { enumerator = pagedReader.GetEnumerator(); }, retryCount); if (!operationStatus.Succeeded) { return(false); } Breadcrumbs <Exception> exceptions = new Breadcrumbs <Exception>(32); try { for (;;) { bool hasMore = false; operationStatus = ADNotificationAdapter.TryRunADOperation(delegate() { try { hasMore = enumerator.MoveNext(); } catch (Exception bc) { exceptions.Drop(bc); enumerator.Dispose(); enumerator = pagedReader.GetEnumerator(); throw; } }, retryCount); if (!operationStatus.Succeeded) { break; } if (!hasMore) { goto IL_AB; } configurationProcessor(enumerator.Current); } return(false); IL_AB :; } finally { enumerator.Dispose(); } return(true); }
// Token: 0x06000363 RID: 867 RVA: 0x000127DC File Offset: 0x000109DC public static bool TryReadConfigurationPaged <T>(ADConfigurationReader <ADPagedReader <T> > configurationReader, ADConfigurationProcessor <T> configurationProcessor, out ADOperationResult operationStatus) where T : IConfigurable, new() { return(ADNotificationAdapter.TryReadConfigurationPaged <T>(configurationReader, configurationProcessor, 10, out operationStatus)); }
// Token: 0x0600035F RID: 863 RVA: 0x000125A0 File Offset: 0x000107A0 public static bool TryReadConfiguration <T>(ADConfigurationReader <T> configurationReader, out T result, int retryCount, out ADOperationResult operationStatus) { if (configurationReader == null) { throw new ArgumentNullException("configurationReader"); } if (retryCount < 0) { throw new ArgumentOutOfRangeException("retryCount", "Number of retries must be equal to or larger than zero."); } result = default(T); T objectReturned = result; operationStatus = ADNotificationAdapter.TryRunADOperation(delegate() { objectReturned = configurationReader(); }, retryCount); result = objectReturned; if (operationStatus.Succeeded) { return(result != null); } if (operationStatus.Exception is ComputerNameNotCurrentlyAvailableException) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_FIND_LOCAL_SERVER_FAILED, Environment.MachineName, new object[] { operationStatus.Exception.Message, Environment.MachineName }); } return(false); }
// Token: 0x0600035E RID: 862 RVA: 0x00012578 File Offset: 0x00010778 public static bool TryReadConfiguration <T>(ADConfigurationReader <T> configurationReader, out T result, out ADOperationResult operationStatus) { return(ADNotificationAdapter.TryReadConfiguration <T>(configurationReader, out result, 10, out operationStatus)); }