public static TADWrapperObject FindAdObjectWithQueryStatic(IADToplogyConfigurationSession adSession, QueryFilter queryFilter)
        {
            TADWrapperObject answer = default(TADWrapperObject);
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                TADWrapperObject[] array = adSession.Find <TADWrapperObject>(null, QueryScope.SubTree, queryFilter, null, 2);
                if (array.Length > 1)
                {
                    SimpleAdObjectLookup <TADWrapperObject> .Tracer.TraceError <QueryFilter, TADWrapperObject, TADWrapperObject>(0L, "FindAdObjectWithQueryStatic found multiple objects with query '{0}'! The first two are '{1}' and '{2}'.", queryFilter, array[0], array[1]);
                    answer = array[(Environment.TickCount & int.MaxValue) % 2];
                    return;
                }
                if (array.Length == 0)
                {
                    SimpleAdObjectLookup <TADWrapperObject> .Tracer.TraceError <QueryFilter>(0L, "FindAdObjectWithQueryStatic found no objects with query '{0}'!", queryFilter);
                    return;
                }
                answer = array[0];
            }, 2);

            if (ex != null)
            {
                SimpleAdObjectLookup <TADWrapperObject> .Tracer.TraceError <Exception>(0L, "FindAdObjectWithQueryStatic got an exception: {0}", ex);
            }
            return(answer);
        }
示例#2
0
        // Token: 0x06001501 RID: 5377 RVA: 0x00052ED0 File Offset: 0x000510D0
        public static MonitoringADConfig GetConfig(AmServerName serverName, IReplayAdObjectLookup adLookup, IReplayAdObjectLookup adLookupPartiallyConsistent, IADToplogyConfigurationSession adSession, IADToplogyConfigurationSession adSessionPartiallyConsistent, Func <bool> isServiceShuttingDownFunc)
        {
            ReplayServerPerfmon.ADConfigRefreshCalls.Increment();
            ReplayServerPerfmon.ADConfigRefreshCallsPerSec.Increment();
            Stopwatch          stopwatch = Stopwatch.StartNew();
            MonitoringADConfig config    = new MonitoringADConfig(serverName, adLookup, adLookupPartiallyConsistent, adSession, adSessionPartiallyConsistent, isServiceShuttingDownFunc);
            Exception          ex        = ADUtils.RunADOperation(delegate()
            {
                config.Refresh();
            }, 2);

            ReplayServerPerfmon.ADConfigRefreshLatency.IncrementBy(stopwatch.ElapsedTicks);
            ReplayServerPerfmon.ADConfigRefreshLatencyBase.Increment();
            ExTraceGlobals.ADCacheTracer.TraceDebug <TimeSpan>((long)config.GetHashCode(), "MonitoringADConfig.GetConfig took {0}", stopwatch.Elapsed);
            if (stopwatch.Elapsed > MonitoringADConfig.MaxHealthyADRefreshDuration)
            {
                ReplayCrimsonEvents.ADConfigRefreshWasSlow.LogPeriodic <TimeSpan>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, stopwatch.Elapsed);
            }
            if (ex != null)
            {
                MonitoringADConfig.Tracer.TraceError <string, string>((long)config.GetHashCode(), "MonitoringADConfig.GetConfig( {0} ): Got exception: {1}", serverName.NetbiosName, AmExceptionHelper.GetExceptionToStringOrNoneString(ex));
                ReplayCrimsonEvents.ADConfigRefreshFailed.LogPeriodic <string, string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, ex.ToString(), Environment.StackTrace);
                throw new MonitoringADConfigException(ex.Message, ex);
            }
            return(config);
        }
        public IADServer ReadMiniServerByObjectId(ADObjectId serverId)
        {
            IADServer result = null;
            Exception ex     = ADUtils.RunADOperation(delegate()
            {
                result = this.AdSession.ReadMiniServer(serverId);
            }, 2);

            if (ex != null)
            {
                SimpleMiniServerLookup.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "SimpleMiniServerLookup.ReadMiniServerByObjectId got an exception: {0}", ex);
            }
            return(result);
        }
        public IADServer FindMiniServerByShortNameEx(string shortName, out Exception ex)
        {
            IADServer result = null;

            ex = ADUtils.RunADOperation(delegate()
            {
                result = this.AdSession.FindMiniServerByName(shortName);
            }, 2);
            if (ex != null)
            {
                SimpleMiniServerLookup.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "SimpleMiniServerLookup.FindMiniServerByFqdn got an exception: {0}", ex);
            }
            return(result);
        }
示例#5
0
        public IADMiniClientAccessServerOrArray ReadMiniClientAccessServerOrArrayByObjectId(ADObjectId serverId)
        {
            IADMiniClientAccessServerOrArray result = null;
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                result = this.cdsAdSession.ReadMiniClientAccessServerOrArray(serverId);
            }, 2);

            if (ex != null)
            {
                SimpleMiniClientAccessServerOrArrayLookup.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "SimpleMiniClientAccessServerOrArrayLookup.ReadMiniClientAccessServerOrArrayByObjectId got an exception: {0}", ex);
            }
            return(result);
        }
示例#6
0
        internal static IADMiniClientAccessServerOrArray FindMiniCasOrArrayByFqdn(IADToplogyConfigurationSession cdsAdSession, string serverFqdn)
        {
            IADMiniClientAccessServerOrArray returnObj = null;
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                returnObj = cdsAdSession.FindMiniClientAccessServerOrArrayByFqdn(serverFqdn);
            }, 2);

            if (ex != null)
            {
                SimpleMiniClientAccessServerOrArrayLookup.Tracer.TraceDebug <Exception>(0L, "SimpleMiniClientAccessServerOrArrayLookup.FindMiniCasOrArrayByFqdn got an exception: {0}", ex);
            }
            return(returnObj);
        }
        public TADWrapperObject ReadAdObjectByObjectIdEx(ADObjectId objectId, out Exception ex)
        {
            TADWrapperObject adObject = default(TADWrapperObject);

            ex = ADUtils.RunADOperation(delegate()
            {
                adObject = this.AdSession.ReadADObject <TADWrapperObject>(objectId);
            }, 2);
            if (ex != null)
            {
                SimpleAdObjectLookup <TADWrapperObject> .Tracer.TraceError <Exception>((long)this.GetHashCode(), "SimpleAdObjectLookup.ReadAdObjectByObjectIdEx got an exception: {0}", ex);
            }
            return(adObject);
        }
示例#8
0
 public IADMiniClientAccessServerOrArray FindMiniClientAccessServerOrArrayWithClientAccess(ADObjectId siteId, ADObjectId preferredServerId)
 {
     return(this.LookupOrFindMiniClientAccessServerOrArray(string.Format("siteid={0}", siteId.ToString()), delegate
     {
         IADMiniClientAccessServerOrArray result = null;
         Exception ex = ADUtils.RunADOperation(delegate()
         {
             result = SimpleMiniClientAccessServerOrArrayLookup.FindMiniCasOrArrayWithClientAccess(this, this.AdSession, siteId, preferredServerId);
         }, 2);
         if (ex != null)
         {
             MiniClientAccessServerOrArrayLookupCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "MiniClientAccessServerOrArrayLookupCache.ReadMiniClientAccessServerOrArrayByObjectId got an exception: {0}", ex);
         }
         return result;
     }));
 }
        public IADServer ReadMiniServerByObjectId(ADObjectId serverId)
        {
            string name = serverId.Name;

            return(this.LookupOrFindMiniServer(name, delegate
            {
                IADServer result = null;
                Exception ex = ADUtils.RunADOperation(delegate()
                {
                    result = this.AdSession.ReadMiniServer(serverId);
                }, 2);
                if (ex != null)
                {
                    MiniServerLookupCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "MiniServerLookupCache.ReadMiniServerByObjectId got an exception: {0}", ex);
                }
                return result;
            }));
        }
示例#10
0
        public IADMiniClientAccessServerOrArray ReadMiniClientAccessServerOrArrayByObjectId(ADObjectId serverId)
        {
            string name = serverId.Name;

            return(this.LookupOrFindMiniClientAccessServerOrArray(name, delegate
            {
                IADMiniClientAccessServerOrArray result = null;
                Exception ex = ADUtils.RunADOperation(delegate()
                {
                    result = this.cdsAdSession.ReadMiniClientAccessServerOrArray(serverId);
                }, 2);
                if (ex != null)
                {
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_ErrorActiveManagerClientADError, ex.Message, new object[0]);
                    MiniClientAccessServerOrArrayLookupCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "MiniClientAccessServerOrArrayLookupCache.ReadMiniClientAccessServerOrArrayByObjectId got an exception: {0}", ex);
                }
                return result;
            }));
        }
示例#11
0
        internal static IADMiniClientAccessServerOrArray FindMiniCasOrArrayByLegdn(IADToplogyConfigurationSession cdsAdSession, string serverLegdn)
        {
            IADMiniClientAccessServerOrArray result = null;
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                bool flag = cdsAdSession.TryFindByExchangeLegacyDN(serverLegdn, out result);
                SimpleMiniClientAccessServerOrArrayLookup.Tracer.TraceDebug <string, bool>(0L, "TryFindByExchangeLegacyDN({0}) returned {1}.", serverLegdn, flag);
                if (!flag)
                {
                    SimpleMiniClientAccessServerOrArrayLookup.Tracer.TraceDebug <string>(0L, "FindMiniCasOrArrayByLegdn: Could not find a MiniServer for the legdn extracted server '{0}'.", serverLegdn);
                }
            }, 2);

            if (ex != null)
            {
                SimpleMiniClientAccessServerOrArrayLookup.Tracer.TraceDebug <Exception>(0L, "SimpleMiniClientAccessServerOrArrayLookup.FindMiniCasOrArrayByLegdn got an exception: {0}", ex);
            }
            return(result);
        }
        public static TADWrapperObject FindAdObjectTypeByGuidStatic(IADToplogyConfigurationSession adSession, Guid objectGuid, IPerformanceDataLogger perfLogger)
        {
            if (objectGuid == Guid.Empty)
            {
                throw new ArgumentException("objectGuid cannot be Empty.");
            }
            TADWrapperObject adObject = default(TADWrapperObject);
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                QueryFilter filter       = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, objectGuid);
                TADWrapperObject[] array = adSession.Find <TADWrapperObject>(null, QueryScope.SubTree, filter, null, 1);
                adObject = ((array != null && array.Length > 0) ? array[0] : default(TADWrapperObject));
            }, perfLogger, 2);

            if (ex != null)
            {
                SimpleAdObjectLookup <TADWrapperObject> .Tracer.TraceError <Exception>(0L, "FindAdObjectTypeByGuidStatic got an exception: {0}", ex);
            }
            return(adObject);
        }
        public IADServer FindMiniServerByShortNameEx(string shortName, out Exception ex)
        {
            Exception tempEx = null;
            IADServer result = this.LookupOrFindMiniServer(shortName, delegate
            {
                IADServer result = null;
                tempEx           = ADUtils.RunADOperation(delegate()
                {
                    result = this.AdSession.FindMiniServerByName(shortName);
                }, 2);
                if (tempEx != null)
                {
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_ErrorActiveManagerClientADError, tempEx.Message, new object[0]);
                    MiniServerLookupCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "MiniServerLookupCache.FindMiniServerByFqdn got an exception: {0}", tempEx);
                }
                return(result);
            });

            ex = tempEx;
            return(result);
        }
示例#14
0
        // Token: 0x06001511 RID: 5393 RVA: 0x00053854 File Offset: 0x00051A54
        protected virtual IEnumerable <IADDatabaseCopy> LookupDatabaseCopies(IADServer miniServer)
        {
            MonitoringADConfig.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Searching for all valid/invalid database copies...", miniServer.Name);
            IEnumerable <IADDatabaseCopy>  dbCopies  = null;
            IADToplogyConfigurationSession adSession = this.AdSessionPartiallyConsistent;
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                dbCopies = adSession.GetAllDatabaseCopies(miniServer);
            }, 2);

            if (ex != null)
            {
                MonitoringADConfig.Tracer.TraceError <string, string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Got exception: {1}", miniServer.Name, AmExceptionHelper.GetExceptionToStringOrNoneString(ex));
                throw new MonitoringCouldNotFindDatabasesException(miniServer.Name, ex.Message, ex);
            }
            if (dbCopies == null)
            {
                dbCopies = new IADDatabaseCopy[0];
            }
            return(dbCopies);
        }
        public static TADWrapperObject FindAdObjectByServerNameStatic(IADToplogyConfigurationSession adSession, string serverName, out Exception exception)
        {
            if (string.IsNullOrEmpty(serverName))
            {
                throw new ArgumentNullException("serverName");
            }
            exception = null;
            TADWrapperObject adObject = default(TADWrapperObject);
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                QueryFilter filter       = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, serverName);
                TADWrapperObject[] array = adSession.Find <TADWrapperObject>(null, QueryScope.SubTree, filter, null, 1);
                adObject = ((array != null && array.Length > 0) ? array[0] : default(TADWrapperObject));
            }, 2);

            if (ex != null)
            {
                exception = ex;
                SimpleAdObjectLookup <TADWrapperObject> .Tracer.TraceError <Exception>(0L, "FindAdObjectByServerNameStatic got exception: {0}", ex);
            }
            return(adObject);
        }
示例#16
0
        public TADWrapperObject ReadAdObjectByObjectIdEx(ADObjectId objectId, out Exception exception)
        {
            TADWrapperObject result = default(TADWrapperObject);
            string           name   = objectId.Name;
            Exception        tempEx = null;

            exception = null;
            result    = this.LookupOrFindAdObject(name, delegate
            {
                TADWrapperObject adObject = default(TADWrapperObject);
                tempEx = ADUtils.RunADOperation(delegate()
                {
                    adObject = this.AdSession.ReadADObject <TADWrapperObject>(objectId);
                }, 2);
                if (tempEx != null)
                {
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_ErrorActiveManagerClientADError, tempEx.Message, new object[0]);
                    AdObjectLookupCache <TADWrapperObject> .Tracer.TraceError <Exception>((long)this.GetHashCode(), "AdObjectLookupCache.ReadAdObjectByObjectIdEx got exception: {0}", tempEx);
                }
                return(adObject);
            }, AdObjectLookupFlags.None);
            exception = tempEx;
            return(result);
        }