예제 #1
0
        public void Stop(int nodeId)
        {
            IEmulatedNode node = null;

            lock (sync_nodes)
            {
                nodes.TryGetValue(nodeId, out node);
            }
            //var node = nodes.Where(r => r.NodeAddress.NodeAddressId == nodeId).FirstOrDefault();
            if (node != null)
            {
                if (node is TcpRaftNode)
                {
                    if (((TcpRaftNode)node).Disposed)
                    {
                        return;
                    }

                    ((TcpRaftNode)node).Dispose();

                    lock (sync_nodes)
                    {
                        //nodes[nodeId] = null;
                    }

                    node = null;
                }
                else
                {
                    node.EmulationStop();
                }
            }
        }
        public void Stop(int nodeId)
        {
            IEmulatedNode node = null;

            lock (sync_nodes)
            {
                nodes.TryGetValue(nodeId, out node);
            }
            if (node != null)
            {
                if (node is TcpRaftNode)
                {
                    if (((TcpRaftNode)node).Disposed)
                    {
                        return;
                    }

                    ((TcpRaftNode)node).Dispose();

                    lock (sync_nodes)
                    {
                        //nodes[nodeId] = null;
                    }

                    node = null;
                }
                else
                {
                    node.EmulationStop();
                }
            }
        }