Exemple #1
0
        public ConfiguredCacheInfo[] GetConfiguredPartitionedReplicaCaches()
        {
            ConfiguredCacheInfo[] configuredCaches = new ConfiguredCacheInfo[s_partitionedCaches.Count];

            _rwLock.AcquireReaderLock(Timeout.Infinite);
            try
            {
                IDictionaryEnumerator en = s_partitionedCaches.GetEnumerator();
                int i = 0;
                while (en.MoveNext())
                {
                    string cacheId = en.Key as string;
                    Hashtable partitionedCaches = en.Value as Hashtable;
                    if (partitionedCaches != null)
                    {
                        foreach (DictionaryEntry de in partitionedCaches)
                        {
                            string partId = de.Key as string;
                            CacheInfo cacheInfo = (CacheInfo)de.Value;

                            ConfiguredCacheInfo configuredCache = new ConfiguredCacheInfo();
                            configuredCache.CacheId = cacheInfo.CacheProps.Name;
                            configuredCache.IsRunning = cacheInfo.Cache.IsRunning;
                            configuredCache.DataCapacity = cacheInfo.CacheProps.Storage.Size;
                            configuredCache.CachePropString = GetProps(cacheInfo.CacheProps);
                            configuredCache.PartId = partId;

                            if (cacheInfo.CacheProps.CacheType == "clustered-cache")
                            {
                                if (cacheInfo.CacheProps.Cluster != null)
                                {
                                    switch (cacheInfo.CacheProps.Cluster.Topology)
                                    {
                                        case "replicated-server":
                                            configuredCache.Topology = CacheTopology.Replicated;
                                            break;
                                        
                                        case "partitioned-server":
                                            configuredCache.Topology = CacheTopology.Partitioned;
                                            break;
                                    }
                                }
                            }
                            else if (cacheInfo.CacheProps.CacheType == "local-cache")
                            {
                                configuredCache.Topology = CacheTopology.Local;
                            }


                            configuredCaches[i] = configuredCache;
                            i++;
                        }
                    }
                }
                return configuredCaches;
            }
            finally
            {
                _rwLock.ReleaseReaderLock();
            }
        }
Exemple #2
0
        public ConfiguredCacheInfo[] GetAllConfiguredCaches()
        {
            ConfiguredCacheInfo[] configuredCaches = new ConfiguredCacheInfo[s_caches.Count];

            try
            {
                _rwLock.AcquireReaderLock(Timeout.Infinite);
                IDictionaryEnumerator ide = s_caches.GetEnumerator();
                int i = 0;
                while (ide.MoveNext())
                {
                    CacheInfo cacheInfo = ide.Value as CacheInfo;
                    ConfiguredCacheInfo configuredCache = new ConfiguredCacheInfo();
                    configuredCache.CacheId = cacheInfo.CacheProps.Name;
                    configuredCache.IsRunning = cacheInfo.Cache.IsRunning;
                    configuredCache.DataCapacity = cacheInfo.CacheProps.Storage.Size;
                    configuredCache.CachePropString = GetProps(cacheInfo.CacheProps);

                    if (cacheInfo.CacheProps.CacheType == "clustered-cache")
                    {
                        if (cacheInfo.CacheProps.Cluster != null)
                        {
                            switch (cacheInfo.CacheProps.Cluster.Topology)
                            {
                                case "replicated-server":
                                    configuredCache.Topology = CacheTopology.Replicated;
                                    break;
                                
                                case "partitioned-server":
                                    configuredCache.Topology = CacheTopology.Partitioned;
                                    break;
                            }
                        }
                    }
                    else if (cacheInfo.CacheProps.CacheType == "local-cache")
                    {
                        configuredCache.Topology = CacheTopology.Local;
                    }
                    configuredCaches[i] = configuredCache;
                    i++;
                }

            }
            finally
            {
                _rwLock.ReleaseReaderLock();
            }
            return configuredCaches;
        }