Exemple #1
0
        public static bool UpdateActiveIfMaxActivesNotExceeded(Guid databaseGuid, 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)
                {
                    result = databaseStateTracker.UpdateActiveIfMaxActivesNotExceeded(databaseGuid, serverName, num);
                }
            }
            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);
        }