Esempio n. 1
0
        internal ClusterNodeInfo GetActualClusterNode(byte cnid, bool canUseOverloaded)
        {
            ClusterNodeInfo nearestOverloadedNode = null;
            int             nodeCount             = _appServerNodeMap.Length;

            for (int actualNodeDisp = nodeCount; actualNodeDisp > 0; actualNodeDisp--)
            {
                var             actualCnid = (byte)(cnid + nodeCount - actualNodeDisp);
                ClusterNodeInfo nodeInfo   = _appServerNodeMap[actualCnid % _appServerNodeMap.Length];
                switch (nodeInfo.State)
                {
                case ClusterNodeState.Overload:
                    if (canUseOverloaded && nearestOverloadedNode == null)
                    {
                        nearestOverloadedNode = nodeInfo;
                    }
                    break;

                case ClusterNodeState.Maintenance:
                case ClusterNodeState.Offline:
                    break;

                default:
                    return(nodeInfo);
                }
            }
            if (nearestOverloadedNode == null)
            {
                throw new MaintenanceException("There is no online service detected.");
            }
            return(nearestOverloadedNode);
        }
Esempio n. 2
0
        public WcfServiceServerInfo CreateServiceServerInfo(string applicationServerNodeKey, Type contractType, Type serviceType)
        {
            ClusterNodeInfo nodeInfo = _appServerNodes[applicationServerNodeKey];
            var             uri      = new Uri(string.Format("net.tcp://{0}:{1}", nodeInfo.Host, nodeInfo.FirstPortNumber));

            return(new WcfServiceServerInfo(contractType, serviceType, uri, new NetTcpBinding("defaultNetTcpBinding")));
        }
Esempio n. 3
0
        public WcfServiceBasicInfo CreateServiceBasicInfo(byte cnid, Type contractType)
        {
            ClusterNodeInfo nodeInfo = GetActualClusterNode(cnid, true);
            var             uri      = new Uri(string.Format("net.tcp://{0}:{1}", nodeInfo.Host, nodeInfo.FirstPortNumber));

            return(new WcfServiceBasicInfo(nodeInfo.Key, contractType, uri, new NetTcpBinding("defaultNetTcpBinding")));
        }
Esempio n. 4
0
        public void SetClusterNodeState(string clusterNodeKey, ClusterNodeState state, TimeSpan stateLifetime)
        {
            ClusterNodeInfo nodeInfo = _appServerNodes[clusterNodeKey];

            nodeInfo.SetState(state, stateLifetime);
        }
Esempio n. 5
0
        public void SetClusterNodeState(byte cnid, ClusterNodeState state, TimeSpan stateLifetime)
        {
            ClusterNodeInfo nodeInfo = _appServerNodeMap[cnid % _appServerNodeMap.Length];

            nodeInfo.SetState(state, stateLifetime);
        }
Esempio n. 6
0
        public ClusterNodeState GetClusterNodeState(string clusterNodeKey)
        {
            ClusterNodeInfo nodeInfo = _appServerNodes[clusterNodeKey];

            return(nodeInfo.State);
        }
Esempio n. 7
0
        public ClusterNodeState GetClusterNodeState(byte cnid)
        {
            ClusterNodeInfo nodeInfo = _appServerNodeMap[cnid % _appServerNodeMap.Length];

            return(nodeInfo.State);
        }