Exemple #1
0
        public void Dispose()
        {
            if (_membershipManager != null)
            {
                _membershipManager.Dispose();
            }



            if (_shardChannels != null)
            {
                lock (_shardChannels)
                {
                    foreach (KeyValuePair <Server, IDualChannel> pair in _shardChannels)
                    {
                        try
                        {
                            ((IDualChannel)pair.Value).Disconnect();
                            if (LoggerManager.Instance.ShardLogger != null && LoggerManager.Instance.ShardLogger.IsDebugEnabled)
                            {
                                LoggerManager.Instance.ShardLogger.Debug("Localshard.Dispose(): ", "Connection of local node " + context.LocalAddress.ToString() + " disconected from node " + ((IDualChannel)pair.Value).PeerAddress.ToString());
                            }
                        }
                        catch (Exception ex)
                        {
                            if (LoggerManager.Instance.ShardLogger != null && LoggerManager.Instance.ShardLogger.IsErrorEnabled)
                            {
                                LoggerManager.Instance.ShardLogger.Error("Local Shard Dispose()", "Error:", ex);
                            }
                        }
                    }
                    //_shardChannels = null;
                }
            }

            lock (_mutexOnnodeRole)
            {
                if (NodeRole != NodeRole.Intermediate)
                {
                    NodeRole = Common.Configuration.Services.NodeRole.None;
                }
            }
        }