示例#1
0
        private void LazyInit()
        {
            int num = 30;

            try
            {
                if (!Monitor.TryEnter(this.syncLock, TimeSpan.FromSeconds((double)num)))
                {
                    throw new ServerComponentApiException(DirectoryStrings.ServerComponentReadTimeout(num));
                }
                if (!this.m_lastKnownADComponentStatesAreSet)
                {
                    MultiValuedProperty <string> adStates = null;
                    Exception ex = ServerComponentStateManager.RunADOperationNoThrow(delegate
                    {
                        adStates = ServerComponentStateManager.ReadLocalServerComponentStatesFromAD();
                    });
                    if (ex != null)
                    {
                        ServerComponentStateManager.Tracer.TraceError <Exception>(0L, "LazyInit failed: {0}", ex);
                    }
                    this.SetAdStates(adStates);
                }
            }
            finally
            {
                if (Monitor.IsEntered(this.syncLock))
                {
                    Monitor.Exit(this.syncLock);
                }
            }
        }
示例#2
0
        public static void SyncAdState()
        {
            MultiValuedProperty <string> adStates = null;
            Exception ex = ServerComponentStateManager.RunADOperationNoThrow(delegate
            {
                adStates = ServerComponentStateManager.ReadLocalServerComponentStatesFromAD();
                ServerComponentStateManager.UseAdStates(adStates);
            });

            if (ex != null)
            {
                ServerComponentStateManager.Tracer.TraceError <Exception>(0L, "SyncAdState failed to read from AD: {0}", ex);
                throw new ServerComponentApiException(DirectoryStrings.ServerComponentReadADError(ex.ToString()), ex);
            }
            Exception ex2 = ServerComponentStateManager.RunLocalRegistryOperationNoThrow(delegate
            {
                ServerComponentStates.SyncComponentStates(adStates);
            });

            if (ex2 != null)
            {
                ServerComponentStateManager.Tracer.TraceError <Exception>(0L, "SyncAdState failed in ServerComponentStates.SyncComponentStates: {0}", ex2);
                throw new ServerComponentApiException(DirectoryStrings.ServerComponentLocalRegistryError(ex2.ToString()), ex2);
            }
        }