Exemplo n.º 1
0
        private ActiveManager(bool enableRpcCaching, IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup, IFindAdObject <IADServer> serverLookup, IFindMiniServer miniServerLookup, IFindAdObject <IADClientAccessArray> casLookup, IFindMiniClientAccessServerOrArray miniCasArrayLookup, IFindAdObject <IADDatabase> databaseLookup, ITopologyConfigurationSession adSession, bool isService)
        {
            ExTraceGlobals.ActiveManagerClientTracer.TraceDebug <bool>((long)this.GetHashCode(), "Active Manager is instantiated (cacheEnabled={0})", enableRpcCaching);
            if (adSession == null)
            {
                throw new ArgumentNullException("adSession");
            }
            IADToplogyConfigurationSession adSession2 = ADSessionFactory.CreateWrapper(adSession);

            this.m_isCacheEnabled = enableRpcCaching;
            this.m_adSession      = adSession;
            this.m_disposeTracker = this.GetDisposeTracker();
            if (this.m_isCacheEnabled)
            {
                this.m_dagLookup          = (dagLookup ?? new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession2, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .TimeToLive, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .AdOperationTimeout));
                this.m_casLookup          = (casLookup ?? new AdObjectLookupCache <IADClientAccessArray>(adSession2, AdObjectLookupCache <IADClientAccessArray> .TimeToLive, AdObjectLookupCache <IADClientAccessArray> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADClientAccessArray> .AdOperationTimeout));
                this.m_miniServerLookup   = (miniServerLookup ?? new MiniServerLookupCache(adSession2, MiniServerLookupCache.TimeToLive, MiniServerLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniServerLookupCache.AdOperationTimeout));
                this.m_miniCasArrayLookup = (miniCasArrayLookup ?? new MiniClientAccessServerOrArrayLookupCache(this.m_adSession, MiniClientAccessServerOrArrayLookupCache.TimeToLive, MiniClientAccessServerOrArrayLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniClientAccessServerOrArrayLookupCache.AdOperationTimeout));
                this.m_databaseLookup     = (databaseLookup ?? new AdObjectLookupCache <IADDatabase>(adSession2, AdObjectLookupCache <IADDatabase> .TimeToLive, AdObjectLookupCache <IADDatabase> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabase> .AdOperationTimeout));
                if (!isService)
                {
                    this.EnableMinimization();
                }
            }
            else
            {
                this.m_dagLookup          = (dagLookup ?? new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession2));
                this.m_casLookup          = (casLookup ?? new SimpleAdObjectLookup <IADClientAccessArray>(adSession2));
                this.m_miniServerLookup   = (miniServerLookup ?? new SimpleMiniServerLookup(adSession2));
                this.m_miniCasArrayLookup = (miniCasArrayLookup ?? new SimpleMiniClientAccessServerOrArrayLookup(this.m_adSession));
                this.m_databaseLookup     = (databaseLookup ?? new SimpleAdObjectLookup <IADDatabase>(adSession2));
            }
            this.CacheUpdateInterval  = new TimeSpan(0, 0, 60);
            this.m_isRunningInService = isService;
        }
        internal static void UpdateServerLegdnForDatabaseSite(Task.TaskErrorLoggingDelegate writeErrorDelegate, Task.TaskVerboseLoggingDelegate writeVerboseDelegate, ITopologyConfigurationSession adSession, DatabaseCopy dbCopy)
        {
            ADObjectId hostServer = dbCopy.HostServer;

            PropertyDefinition[] properties = new PropertyDefinition[]
            {
                ServerSchema.ServerSite
            };
            MiniServer miniServer = adSession.ReadMiniServer(hostServer, properties);

            if (miniServer == null)
            {
                writeErrorDelegate(new ADServerNotFoundException(hostServer.ToString()), ErrorCategory.InvalidArgument, null);
            }
            IADToplogyConfigurationSession adSession2 = ADSessionFactory.CreateWrapper(adSession);
            SimpleAdObjectLookup <IADClientAccessArray> findClientAccessArray      = new SimpleAdObjectLookup <IADClientAccessArray>(adSession2);
            SimpleMiniClientAccessServerOrArrayLookup   findMiniClientAccessServer = new SimpleMiniClientAccessServerOrArrayLookup(adSession);
            ADObjectId serverSite = miniServer.ServerSite;
            LegacyDN   legacyDN   = ActiveManagerImplementation.FindClientAccessArrayOrServerFromSite(serverSite, miniServer.Id, findClientAccessArray, findMiniClientAccessServer, AdObjectLookupFlags.ReadThrough);
            ADObjectId parent     = dbCopy.Id.Parent;
            Database   database   = adSession.Read <Database>(parent);

            if (legacyDN != null)
            {
                LegacyDN databaseLegacyDNFromRcaLegacyDN = Database.GetDatabaseLegacyDNFromRcaLegacyDN(legacyDN, database.IsPublicFolderDatabase);
                database.ExchangeLegacyDN = databaseLegacyDNFromRcaLegacyDN.ToString();
                writeVerboseDelegate(Strings.UpdatingLegDnForDatabaseToServer(database.Name, legacyDN.ToString(), legacyDN.ToString()));
                adSession.Save(database);
                return;
            }
            ExTraceGlobals.CmdletsTracer.TraceDebug <ADObjectId>(0L, "Could not find a new CAS machines for site '{0}'. Leaving the database's legdn unchanged.", serverSite);
        }
        protected void Initialize(ConsistencyMode adConsistencyMode)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(adConsistencyMode, ADSessionSettings.FromRootOrgScopeSet(), 92, "Initialize", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\Service\\NoncachingReplayAdObjectLookup.cs");

            this.AdSession = topologyConfigurationSession;
            IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession);

            this.DagLookup        = new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession);
            this.DatabaseLookup   = new SimpleAdObjectLookup <IADDatabase>(adSession);
            this.ServerLookup     = new SimpleAdObjectLookup <IADServer>(adSession);
            this.MiniServerLookup = new SimpleMiniServerLookup(adSession);
        }
Exemplo n.º 4
0
        // Token: 0x06001E72 RID: 7794 RVA: 0x0008A730 File Offset: 0x00088930
        protected void Initialize(ConsistencyMode adConsistencyMode)
        {
            ITopologyConfigurationSession  topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(adConsistencyMode, ADSessionSettings.FromRootOrgScopeSet(), 101, "Initialize", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\Service\\ReplayAdObjectLookup.cs");
            IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession);
            TimeSpan timeToLive         = TimeSpan.FromSeconds((double)RegistryParameters.AdObjectCacheHitTtlInSec);
            TimeSpan timeToNegativeLive = TimeSpan.FromSeconds((double)RegistryParameters.AdObjectCacheMissTtlInSec);

            this.AdSession        = topologyConfigurationSession;
            this.DagLookup        = new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession, timeToLive, timeToNegativeLive);
            this.DatabaseLookup   = new AdObjectLookupCache <IADDatabase>(adSession, timeToLive, timeToNegativeLive);
            this.ServerLookup     = new AdObjectLookupCache <IADServer>(adSession, timeToLive, timeToNegativeLive);
            this.MiniServerLookup = new MiniServerLookupCache(adSession, timeToLive, timeToNegativeLive);
        }
Exemplo n.º 5
0
        public static ActiveManager CreateCustomActiveManager(bool cacheRpcRequests, IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup, IFindAdObject <IADServer> serverLookup, IFindMiniServer miniServerLookup, IFindAdObject <IADClientAccessArray> casLookup, IFindMiniClientAccessServerOrArray miniCasArrayLookup, IFindAdObject <IADDatabase> databaseLookup, ITopologyConfigurationSession adSession, bool isService)
        {
            if (adSession == null)
            {
                adSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1200, "CreateCustomActiveManager", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs");
            }
            IADToplogyConfigurationSession adSession2 = ADSessionFactory.CreateWrapper(adSession);

            dagLookup          = (dagLookup ?? new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession2));
            serverLookup       = (serverLookup ?? new SimpleAdObjectLookup <IADServer>(adSession2));
            miniServerLookup   = (miniServerLookup ?? new SimpleMiniServerLookup(adSession2));
            casLookup          = (casLookup ?? new SimpleAdObjectLookup <IADClientAccessArray>(adSession2));
            miniCasArrayLookup = (miniCasArrayLookup ?? new SimpleMiniClientAccessServerOrArrayLookup(adSession));
            databaseLookup     = (databaseLookup ?? new SimpleAdObjectLookup <IADDatabase>(adSession2));
            return(new ActiveManager(cacheRpcRequests, dagLookup, serverLookup, miniServerLookup, casLookup, miniCasArrayLookup, databaseLookup, adSession, isService));
        }
Exemplo n.º 6
0
 public static ActiveManager GetNoncachingActiveManagerInstance()
 {
     if (ActiveManager.s_uncachedActiveManager == null)
     {
         lock (ActiveManager.s_singletonLock)
         {
             if (ActiveManager.s_uncachedActiveManager == null)
             {
                 ITopologyConfigurationSession  topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1023, "GetNoncachingActiveManagerInstance", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs");
                 IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession);
                 ActiveManager.s_uncachedActiveManager = new ActiveManager(false, new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession), new SimpleAdObjectLookup <IADServer>(adSession), new SimpleMiniServerLookup(adSession), new SimpleAdObjectLookup <IADClientAccessArray>(adSession), new SimpleMiniClientAccessServerOrArrayLookup(topologyConfigurationSession), new SimpleAdObjectLookup <IADDatabase>(adSession), topologyConfigurationSession, false);
                 ActiveManager.s_uncachedActiveManager.SuppressDisposeTracker();
             }
         }
     }
     return(ActiveManager.s_uncachedActiveManager);
 }
Exemplo n.º 7
0
 public static ActiveManager GetCachingActiveManagerInstance()
 {
     if (ActiveManager.s_cachedActiveManager == null)
     {
         lock (ActiveManager.s_singletonLock)
         {
             if (ActiveManager.s_cachedActiveManager == null)
             {
                 ITopologyConfigurationSession  topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1240, "GetCachingActiveManagerInstance", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs");
                 IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession);
                 TimeSpan timeSpan = new TimeSpan(0, 0, 45);
                 ActiveManager.s_cachedActiveManager = new ActiveManager(true, new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession, timeSpan, timeSpan, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .AdOperationTimeout), new AdObjectLookupCache <IADServer>(adSession, AdObjectLookupCache <IADServer> .TimeToLive, AdObjectLookupCache <IADServer> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADServer> .AdOperationTimeout), new MiniServerLookupCache(adSession, MiniServerLookupCache.TimeToLive, MiniServerLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniServerLookupCache.AdOperationTimeout), new AdObjectLookupCache <IADClientAccessArray>(adSession, AdObjectLookupCache <IADClientAccessArray> .TimeToLive, AdObjectLookupCache <IADClientAccessArray> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADClientAccessArray> .AdOperationTimeout), new MiniClientAccessServerOrArrayLookupCache(topologyConfigurationSession, MiniClientAccessServerOrArrayLookupCache.TimeToLive, MiniClientAccessServerOrArrayLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniClientAccessServerOrArrayLookupCache.AdOperationTimeout), new AdObjectLookupCache <IADDatabase>(adSession, AdObjectLookupCache <IADDatabase> .TimeToLive, AdObjectLookupCache <IADDatabase> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabase> .AdOperationTimeout), topologyConfigurationSession, false);
                 ActiveManager.s_cachedActiveManager.SuppressDisposeTracker();
             }
         }
     }
     return(ActiveManager.s_cachedActiveManager);
 }
Exemplo n.º 8
0
        public static ActiveManager CreateRemoteActiveManager(string domainControllerName, NetworkCredential networkCredential, bool createCachingActiveManager)
        {
            ITopologyConfigurationSession  topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(domainControllerName, true, ConsistencyMode.FullyConsistent, networkCredential, ADSessionSettings.FromRootOrgScopeSet(), 1071, "CreateRemoteActiveManager", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs");
            IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession);
            IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup;
            IFindAdObject <IADServer>            serverLookup;
            IFindMiniServer                      miniServerLookup;
            IFindAdObject <IADClientAccessArray> casLookup;
            IFindMiniClientAccessServerOrArray   miniCasArrayLookup;
            IFindAdObject <IADDatabase>          databaseLookup;

            if (createCachingActiveManager)
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, 75);
                dagLookup          = new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession, timeSpan, timeSpan, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .AdOperationTimeout);
                serverLookup       = new AdObjectLookupCache <IADServer>(adSession, AdObjectLookupCache <IADServer> .TimeToLive, AdObjectLookupCache <IADServer> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADServer> .AdOperationTimeout);
                miniServerLookup   = new MiniServerLookupCache(adSession, MiniServerLookupCache.TimeToLive, MiniServerLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniServerLookupCache.AdOperationTimeout);
                casLookup          = new AdObjectLookupCache <IADClientAccessArray>(adSession, AdObjectLookupCache <IADClientAccessArray> .TimeToLive, AdObjectLookupCache <IADClientAccessArray> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADClientAccessArray> .AdOperationTimeout);
                miniCasArrayLookup = new MiniClientAccessServerOrArrayLookupCache(topologyConfigurationSession, MiniClientAccessServerOrArrayLookupCache.TimeToLive, MiniClientAccessServerOrArrayLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniClientAccessServerOrArrayLookupCache.AdOperationTimeout);
                databaseLookup     = new AdObjectLookupCache <IADDatabase>(adSession, AdObjectLookupCache <IADDatabase> .TimeToLive, AdObjectLookupCache <IADDatabase> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabase> .AdOperationTimeout);
            }
            else
            {
                dagLookup          = new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession);
                serverLookup       = new SimpleAdObjectLookup <IADServer>(adSession);
                miniServerLookup   = new SimpleMiniServerLookup(adSession);
                casLookup          = new SimpleAdObjectLookup <IADClientAccessArray>(adSession);
                miniCasArrayLookup = new SimpleMiniClientAccessServerOrArrayLookup(topologyConfigurationSession);
                databaseLookup     = new SimpleAdObjectLookup <IADDatabase>(adSession);
            }
            ActiveManager activeManager = new ActiveManager(createCachingActiveManager, dagLookup, serverLookup, miniServerLookup, casLookup, miniCasArrayLookup, databaseLookup, topologyConfigurationSession, false);

            activeManager.m_networkCredential = networkCredential;
            ExTraceGlobals.ActiveManagerClientTracer.TraceDebug <string>(0L, "Created an ActiveManager suitable for cross-forest queries, dcName={0}.", domainControllerName);
            return(activeManager);
        }