Ejemplo n.º 1
0
        private void InitiateShutdown()
        {
            if ((tvNodes.Items.Count == 0) || (tvNodes.SelectedValue == null))
            {
                return;
            }

            Func<Node, bool> nodeFinder = (x => x.EndPoint.ToString().CompareTo(tvNodes.SelectedValue) == 0);
            Node node = _nodeTracker.ActiveNodes.First<Node>(nodeFinder);
            if (node == null)
            {
                MessageBox.Show("Could not locate the node service entry. Shutdown call will not be made.");
                return;
            }

            //for this node, get the active data from the node
            string endPoint = string.Format("net.tcp://{0}:{1}/HoCCacheService", node.EndPoint.ToString(), node.ServicePort);
            CacheService.CacheServiceClient nodeService = new CacheService.CacheServiceClient(new NetTcpBinding(SecurityMode.None), new EndpointAddress(endPoint));
            nodeService.Open();
            nodeService.Stop();

            MessageBox.Show("Successfully called Shutdown on server : " + tvNodes.SelectedValue);
        }
Ejemplo n.º 2
0
        private void UpdateGridDataSource()
        {
            lock (dataList)
            {
                if ((tvNodes.Items.Count == 0) || (tvNodes.SelectedValue == null))
                {
                    ClearGrid();
                    return;
                }

                Func<Node, bool> nodeFinder = (x => x.EndPoint.ToString().CompareTo(tvNodes.SelectedValue) == 0);
                Node node = _nodeTracker.ActiveNodes.First<Node>(nodeFinder);
                if (node == null)
                    return;

                dataList.Clear();

                //for this node, get the active data from the node
                string endPoint = string.Format("net.tcp://{0}:{1}/HoCCacheService", node.EndPoint.ToString(), node.ServicePort);
                CacheService.CacheServiceClient nodeService = new CacheService.CacheServiceClient(new NetTcpBinding(SecurityMode.None), new EndpointAddress(endPoint));
                try
                {
                    nodeService.Open();
                    CacheHealth cacheHealth = nodeService.GetCacheHealth();
                    dataList.Add(new KeyValuePair<string, string>("Machine Name", cacheHealth.MachineName));
                    dataList.Add(new KeyValuePair<string, string>("Host", tvNodes.SelectedValue.ToString()));
                    dataList.Add(new KeyValuePair<string, string>("Heartbeat Heard at", node.HeartBeatLastHeardAt.ToLongTimeString()));
                    dataList.Add(new KeyValuePair<string, string>("Service Port", node.ServicePort.ToString()));
                    dataList.Add(new KeyValuePair<string, string>("Node State", node.NodeState.ToString()));

                    dataList.Add(new KeyValuePair<string, string>("Object Count", cacheHealth.ObjectCount.ToString()));
                    dataList.Add(new KeyValuePair<string, string>("Object(s) Size", cacheHealth.TotalObjectSize.ToString() + "Bytes"));
                    dataList.Add(new KeyValuePair<string, string>("Process Working Set", cacheHealth.ProcessWorkingSet.ToString() + "K"));
                    dataList.Add(new KeyValuePair<string, string>("Eviction Strategy", cacheHealth.EvictionStrategy));
                    if (cacheHealth.EvictionLastAt == DateTime.MinValue)
                        dataList.Add(new KeyValuePair<string, string>("Last Eviction Time", "never"));
                    else
                        dataList.Add(new KeyValuePair<string, string>("Last Eviction Time", cacheHealth.EvictionLastAt.ToLongTimeString()));

                    UpdateStatusMessage("Updated status for " + tvNodes.SelectedValue.ToString());
                }
                catch(Exception E)
                {
                    UpdateStatusMessage("Error when connecting to " + tvNodes.SelectedValue.ToString());
                }
            }
        }