private static void Main() { //1. 单进程模式运行 Framework.Process.RunningState.StandAlone(); //2. 启动运行标识 StateAPI.StateHelper.Put("ISE://system/state/merger/" + Dns.GetHostName(), "merger start running..."); //3. 启动监听 if (_mergerSupervisor == null) { _mergerSupervisor = new Server(Dns.GetHostName(), 8801, ProcessMergerClient, 5); _mergerSupervisor.Listen(); } }
public static void Main(string[] args) { //1. 确定worker运行端口号 int port = 8001; if (args.Length > 0) { port = int.Parse(args[0]); } _machineName = Dns.GetHostName(); _servicePort = port; _statusCenter = new Hashtable(); _runner = new Hashtable(); string processFolder = _servicePort.ToString(CultureInfo.InvariantCulture); if (!Directory.Exists(processFolder)) { Directory.CreateDirectory(processFolder); CopyFile("Init", processFolder); CopyDirectory("Init", processFolder + "\\"); } CheckCrash(); //2. 向State Center发送上线消息 StateHelper.Put("ISE://system/state/worker/" + _machineName + "," + _servicePort, _machineName + ":" + _servicePort + " is ready online!"); //3. 启动心跳线程 Thread thread = new Thread(SendHeartbeat); thread.Start(); //3. 启动任务接收监听 if (_taskSuperviser == null) { Logger.Info("Starting listen the worker's task..."); _taskSuperviser = new Server(_machineName, _servicePort, ProcessTask); Logger.Info("worker's task supervisor instance build success..."); _taskSuperviser.Listen(); } }
private static void KeepMonitor() { Server server = new Server(Dns.GetHostName(), 8600, Heartbeat); server.Listen(); }
public void StartSearcher() { if (File.Exists(_textIndexFile) && TextFragment == null) { TextFragment = Serializer.DeserializeFromFile<InvertFragment>(_textIndexFile); } if (File.Exists(_relativeIndexFile) && RelativeTable == null) { RelativeTable = Serializer.DeserializeFromFile<DimensionTable<string, string, double>>(_relativeIndexFile); } int servicePort = int.Parse(GetRootFolder()) % 100; try { _searchPort += servicePort; Server server = new Server(Dns.GetHostName(), _searchPort, ProcessQuery); WriteToConsole(_searchPort + " is start search service."); server.Listen(); } catch (Exception exception) { WriteToConsole("Start Server Error." + exception); } }
/// <summary> /// 启动返回数据监听 /// </summary> private static void StartListen() { if (_server == null) { _server = new Server(Dns.GetHostName(), 8800, ProcessResponse); _server.Listen(); } }
/// <summary> /// 构造方法 /// </summary> public Executor() { _table = new CyclingHash(); _server = new Server(_host, _listenPort, ProcessRequest); }