//protected Queue<Tuple> tuple_queue = new Queue<Tuple>(); public void initialComponent(Conf config, Context context) { string information = StandardIO.readMsg(); InitialHandshake handshake = InitialHandshake.Parse(information); config = handshake.conf; context = handshake.context; int process_id = Process.GetCurrentProcess().Id; PID temp = new PID(); temp.pid = process_id; string json_pid = JsonMapper.ToJson(temp); try { string dir_path = @handshake.pidDir; System.IO.Directory.CreateDirectory(dir_path); string file = handshake.pidDir + @"\" + process_id.ToString(); if (!System.IO.File.Exists(file)) { System.IO.FileStream f = new System.IO.FileStream(file, System.IO.FileMode.CreateNew); } } catch (Exception e) { // do nothing } StandardIO.sendMsg(json_pid); }
private JsonData readCommand() { if (this.command_queue.Count > 0) { return(command_queue.Dequeue()); } string s = StandardIO.readMsg(); JsonData jd = JsonMapper.ToObject(s); while (jd.IsArray) { command_queue.Enqueue(jd); jd = JsonMapper.ToObject(StandardIO.readMsg()); } return(jd); }
public static JsonData readCommand() { if (pending_commands.Count != 0) { return(pending_commands.Dequeue()); } else { JsonData temp_jd = JsonMapper.ToObject(StandardIO.readMsg()); while (temp_jd.IsArray) { pending_taskids.Enqueue(temp_jd); temp_jd = JsonMapper.ToObject(StandardIO.readMsg()); } return(temp_jd); } }
private void initialComponent(Conf config, Context context) { string information = StandardIO.readMsg(); InitialHandshake handshake = InitialHandshake.Parse(information); config = handshake.conf; context = handshake.context; int process_id = Process.GetCurrentProcess().Id; PID temp = new PID(); temp.pid = process_id; string json_pid = JsonMapper.ToJson(temp); StandardIO.sendMsg(json_pid); string file = handshake.pidDir + "/" + process_id.ToString(); if (!System.IO.File.Exists(file)) { System.IO.FileStream f = new System.IO.FileStream(file, System.IO.FileMode.CreateNew); } }