private string PutRequestOnBox(string node, string filename, string request, ServiceProfile serviceProfile, string fileInBox, int timeoutSeconds) { lock (CallLocker) { this.logger.LogDebug($@"Start checking {filename} request into {node}"); if (!serviceProfile.VerifyServiceProfileOnNode(node)) { this.logger.LogDebug($@"Put Request on {node} fail, either {node} is not up or server-client profile incorrect"); return($"[ORCH-ERR]Put Request on {node} fail, either {node} is not up or profile incorrect."); } var outBoxFile = Path.Combine(Path.Combine(serviceProfile.GetNodeServiceNetLocation(node), "boxes", "outbox"), filename); WriteFileRequest(node, filename, request, serviceProfile, fileInBox); this.logger.LogDebug($@"Request {filename} is written to {node}, and will timeout in {timeoutSeconds} seconds"); if (sync.WaitOne(timeoutSeconds * 1000)) { this.logger.LogDebug($@"Request {filename} comes back, returning result"); return(File.ReadAllText(outBoxFile, Encoding.UTF8)); } else { this.logger.LogDebug($@"Request {filename} timeout ({timeoutSeconds})"); return($@"[ORCH-ERR]the operation time out ({timeoutSeconds})"); } } }
private string PutRequestOnBox(string node, string filename, string request, ServiceProfile serviceProfile, string fileInBox) { lock (CallLocker) { this.logger.LogDebug($@"Start checking {filename} request into {node}"); if (!serviceProfile.VerifyServiceProfileOnNode(node)) { this.logger.LogDebug($@"Put Request on {node} fail, either {node} is not up or server-client profile incorrect"); return($"[ORCH-ERR]Put Request on {node} fail, either {node} is not up or profile incorrect."); } var outBoxFile = Path.Combine(Path.Combine(serviceProfile.GetNodeServiceNetLocation(node), "boxes", "outbox"), filename); WriteFileRequest(node, filename, request, serviceProfile, fileInBox); this.logger.LogDebug($@"Request {filename} is written to {node}, and will wait till the server process the request"); sync.WaitOne(); return(File.ReadAllText(outBoxFile, Encoding.UTF8)); } }