Exemplo n.º 1
0
        /// <summary>
        /// Called after the membership has been changed. Lets the members do some
        /// member oriented tasks.
        /// </summary>
        public override void OnAfterMembershipChange()
        {
            //Ata
            //nTrace.error("PartitionedCache.OnAfterMembershipChanged", "membership changed");
            try
            {
                NotifyHashmapChanged(Cluster.LastViewID, _distributionMgr.GetOwnerHashMapTable(Cluster.Renderers), GetClientMappedServers(Cluster.Servers.Clone() as ArrayList),true, true);
            }
            catch (Exception exc)
            {
            }

            base.OnAfterMembershipChange();

            if (_taskUpdate == null)
            {
                _taskUpdate = new PeriodicPresenceAnnouncer(this, _statsReplInterval);
                _context.TimeSched.AddTask(_taskUpdate);
                _statusLatch.SetStatusBit(NodeStatus.Running, NodeStatus.Initializing);

                //Set joining completion status.
                _initialJoiningStatusLatch.SetStatusBit(NodeStatus.Running, NodeStatus.Initializing);
            }

            //muds:
            //coordinator is responsible for carrying out the automatic load
            //balancing...
            if (Cluster.IsCoordinator)
            {
                if (_isAutoBalancingEnabled)
                {
                    if (_autoBalancingTask == null)
                    {
                        _autoBalancingTask = new AutomaticDataLoadBalancer(this, _autoBalancingInterval);
                        _context.TimeSched.AddTask(_autoBalancingTask);
                    }
                }
            }

           StartStateTransfer(false);

            UpdateCacheStatistics();
            //We announces our status aa uninitalized
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or 
        /// resetting unmanaged resources.
        /// </summary>
        public override void Dispose()
        {
            HasDisposed = true;

            if (_taskUpdate != null)
            {
                _taskUpdate.Cancel();
                _taskUpdate = null;
            }
            if (_autoBalancingTask != null)
            {
                _autoBalancingTask.Cancel();
                _autoBalancingTask = null;
            }
            if (_internalCache != null)
            {
                _internalCache.Dispose();
                _internalCache = null;
            }
            if (_stateTransferTask != null)
            {
                _stateTransferTask.Stop();
                _stateTransferTask = null;
            }

            threadRunning = false;
            base.Dispose();
        }