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); }
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"))); }
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"))); }
public void SetClusterNodeState(string clusterNodeKey, ClusterNodeState state, TimeSpan stateLifetime) { ClusterNodeInfo nodeInfo = _appServerNodes[clusterNodeKey]; nodeInfo.SetState(state, stateLifetime); }
public void SetClusterNodeState(byte cnid, ClusterNodeState state, TimeSpan stateLifetime) { ClusterNodeInfo nodeInfo = _appServerNodeMap[cnid % _appServerNodeMap.Length]; nodeInfo.SetState(state, stateLifetime); }
public ClusterNodeState GetClusterNodeState(string clusterNodeKey) { ClusterNodeInfo nodeInfo = _appServerNodes[clusterNodeKey]; return(nodeInfo.State); }
public ClusterNodeState GetClusterNodeState(byte cnid) { ClusterNodeInfo nodeInfo = _appServerNodeMap[cnid % _appServerNodeMap.Length]; return(nodeInfo.State); }