示例#1
0
        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);
        }
示例#2
0
 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);
     }
 }
示例#3
0
        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);
            }
        }
示例#4
0
 public void emit()
 {
     StandardIO.sendMsg(JsonMapper.ToJson(this) + "\n");
 }