Пример #1
0
        /// <summary>
        /// Initializes a new instance of the Cache class.
        /// </summary>
        /// <param name="objectCache"></param>
        /// <param name="config"></param>
        internal Cache(CacheImplBase objectCache, CacheConfig config)
        {
            _cacheImpl = objectCache;
            _config = config;
            _cacheId = config.CacheId;

            if (_cacheImpl != null)
            {
                _serializationContext = _cacheImpl.Name; //Sets the serialization context.
                _cacheId = _cacheImpl.Name;
            }
            _eventManager = new EventManager(_cacheId, null, this);
            _listener = new CacheEventsListener(this, _eventManager);
            _asyncListener = new CacheAsyncEventsListener(this);
             AddRef();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the Cache class.
        /// </summary>
        /// <param name="objectCache"></param>
        /// <param name="cacheId"></param>        
        internal Cache(CacheImplBase objectCache, string cacheId, PerfStatsCollector2 perfStatsCollector)
        {
            _cacheImpl = objectCache;
            _cacheId = cacheId;
            if (_cacheImpl != null)
            {
                _serializationContext = _cacheImpl.Name; //Sets the serialization context.
            }

            _eventManager = new EventManager(_cacheId, null, this);
            _listener = new CacheEventsListener(this, _eventManager);
            _asyncListener = new CacheAsyncEventsListener(this);

            _perfStatsCollector = perfStatsCollector;

            AddRef();
        }
Пример #3
0
        internal RemoteCache(string cacheId, Cache parent, CacheInitParams initParams, PerfStatsCollector2 perfStatsCol)
            : base()
        {
            _parent = parent;
            _perfStatsCollector = perfStatsCol;
            if (_parent != null)
            {
                _asyncListener = new CacheAsyncEventsListener(_parent.AsyncListener);
                _eventListener = new CacheEventsListener(_parent.EventListener);
            }

            _cacheId = cacheId;
            _broker = new Broker(this, initParams, perfStatsCol);
            // changed this for init param task
            RemoteServer server = _broker.GetInitialServer();
            _broker.StartServices(cacheId, server.IpString, server.Port);

            if (!_broker.IsConnected)
                throw new OperationFailedException("No server is available to process the request for " + _cacheId);
            if (initParams.ServerList != null && initParams.ServerList.Length > 0)
               _serverId = initParams.ServerList[0].Name;
        }