Example #1
0
        public override void StopCacheInstance(string cacheName, CacheInfo cacheInfo, CacheStopReason reason)
        {
            LeasedCache cache = cacheInfo.Cache;

            if (cache != null && cache.Name == cacheName)
            {
                if (cache.IsRunning)
                {
                    if (reason.Equals(CacheStopReason.Expired))
                    {
                        cache.NCacheLog.CriticalInfo("NCache license has expired on this machine. Stopping cache...");
                    }
                    cache.Stop();
                    if (cacheInfo != null)
                    {
                        cacheInfo.SyncConfiguration();
                    }

                    //instrumentation Code
#if COMMUNITY
                    if (InstrumentCache.OnCacheStopped != null)
                    {
                        InstrumentCache.OnCacheStopped(cache.Name);
                    }
#endif
                }
            }
            else
            {
                throw new Runtime.Exceptions.ManagementException("Specified cacheId is not registered");
            }
        }
Example #2
0
        public override void StopCacheInstance(string cacheName, CacheInfo cacheInfo, CacheServer.CacheStopReason reason)
        {
            LeasedCache cache = cacheInfo.Cache;

            if (cache != null && cache.Name == cacheName)
            {
                if (cache.IsRunning)
                {
                    if (!cache.VerifyNodeShutDown())
                    {
                        throw new Runtime.Exceptions.ManagementException("Graceful shutdown is already in progress...");
                    }

                    if (reason.Equals(CacheStopReason.Expired))
                    {
                        cache.NCacheLog.CriticalInfo("NCache license has expired on this machine. Stopping cache...");
                    }

                    cache.Stop();
                    if (cacheInfo != null)
                    {
                        cacheInfo.SyncConfiguration();
                    }

                    if (InstrumentCache.OnCacheStopped != null)
                    {
                        InstrumentCache.OnCacheStopped(cache.Name);
                    }
                }
            }
            else
            {
                throw new Runtime.Exceptions.ManagementException(ErrorCodes.CacheInit.CACHE_ID_NOT_REGISTERED, ErrorMessages.GetErrorMessage(ErrorCodes.CacheInit.CACHE_ID_NOT_REGISTERED));
            }
        }
Example #3
0
        public override void StopCacheInstance(string cacheName, CacheInfo cacheInfo, CacheServer.CacheStopReason reason)
        {
            LeasedCache cache = cacheInfo.Cache;

            if (cache != null && cache.Name == cacheName)
            {
                if (cache.IsRunning)
                {
                    cache.Stop();
                    if (cacheInfo != null)
                    {
                        cacheInfo.SyncConfiguration();
                    }
                    InstrumentCache.OnCacheStopped(cache.Name);
                }
            }
            else
            {
                throw new Runtime.Exceptions.ManagementException("Specified cacheId is not registered");
            }
        }