/*loading the xml files from the build storage and converts it into xml strings * and these strings will be enqueued in the buildrequest queue BrQ*/ public static void loadRequestFiles(string fnames) { string[] filenames = fnames.Split(' '); filenames = filenames.Where(arr => !String.IsNullOrEmpty(arr)).ToArray(); Console.WriteLine("---" + filenames.Count()); Console.WriteLine("\n =================================================="); Console.WriteLine("\n Loading xml test requests from the build storage"); Console.WriteLine("\n =================================================="); Console.WriteLine(fnames); List <string> names = new List <string>(); foreach (string fil in filenames) { Console.WriteLine(fil); string[] files = Directory.GetFiles(BuildEnvironment.fileStorage, fil); Console.WriteLine(files[0]); var xmlString = File.ReadAllText(files[0]); Console.WriteLine(xmlString); BrQ.enQ(xmlString); } }
/*this method acts as process pooling * this thread keeps on checking the buildrequest queue and child process ready queue * if build requests are there in BrQ, it enqueues the first request and sends it to * the first process in the ready queue*/ static void allocateChild() { Console.WriteLine("\n ================================================="); Console.WriteLine("\n Process Pooling started"); Console.WriteLine("\n ================================================="); while (true) { if (ReadyQ.size() != 0 && isQuitMessage) { CommMessage sndMsg = new CommMessage(CommMessage.MessageType.request); sndMsg.author = "Dinesh Dhamotharan"; sndMsg.to = "http://localhost:" + ReadyQ.deQ() + "/IPluggableComm"; sndMsg.from = "http://localhost:8080/IMessagePassingComm"; sndMsg.body = "Quit"; sndMsg.command = "Quit"; sndMsg.port = 8080; comm.postMessage(sndMsg); Console.WriteLine("\n sending message to child:{0}", sndMsg.body); } if (BrQ.size() != 0) { if (ReadyQ.size() != 0) { CommMessage sndMsg = new CommMessage(CommMessage.MessageType.request); sndMsg.command = "request"; sndMsg.author = "Dinesh Dhamotharan"; sndMsg.to = "http://localhost:" + ReadyQ.deQ() + "/IPluggableComm"; sndMsg.from = "http://localhost:8080/IMessagePassingComm"; sndMsg.body = BrQ.deQ(); sndMsg.command = "request"; sndMsg.port = 8080; Console.WriteLine("\n reached here"); comm.postMessage(sndMsg); Console.WriteLine("\n sending message to child:{0}", sndMsg.body); } } } }