Example #1
0
        private static bool IsMaxActivesUnderThreshold(AmServerName serverName, Func <IADServer, int?> getMaxActiveDbsLimit, out int?maxActiveDatabases)
        {
            bool      result    = true;
            int?      num       = null;
            IADServer iadserver = Dependencies.ReplayAdObjectLookup.ServerLookup.FindServerByFqdn(serverName.Fqdn);

            if (iadserver != null)
            {
                num = getMaxActiveDbsLimit(iadserver);
                AmDatabaseStateTracker databaseStateTracker = AmSystemManager.Instance.DatabaseStateTracker;
                if (databaseStateTracker != null && databaseStateTracker.IsMaxActivesExceeded(serverName, num))
                {
                    result = false;
                }
            }
            else
            {
                AmTrace.Error("Failed to find server {0}", new object[]
                {
                    serverName
                });
                FailedToFindServerException ex = new FailedToFindServerException(serverName.Fqdn);
                ReplayCrimsonEvents.ADObjectLookupError.LogPeriodic <string, FailedToFindServerException>(serverName.NetbiosName, DiagCore.DefaultEventSuppressionInterval, ex.Message, ex);
            }
            maxActiveDatabases = num;
            return(result);
        }
Example #2
0
        public static IADServer GetMiniServer(AmServerName serverName, out Exception exception)
        {
            Exception ex = null;

            exception = null;
            IADServer iadserver = Dependencies.ReplayAdObjectLookup.MiniServerLookup.FindMiniServerByShortNameEx(serverName.NetbiosName, out ex);

            if (iadserver == null)
            {
                exception = new FailedToFindServerException(serverName.Fqdn, ex);
                AmTrace.Error("GetMiniServer got back 'null' from FindMiniServerByName for server '{0}'. Returning Exception: {1}", new object[]
                {
                    serverName,
                    exception
                });
                ReplayCrimsonEvents.ADObjectLookupError.LogPeriodic <string, Exception>(serverName.NetbiosName, DiagCore.DefaultEventSuppressionInterval, exception.Message, ex);
            }
            return(iadserver);
        }