On Fri, Apr 5, 2019 at 4:11 AM Daniel Anechitoaie <
danie...@gmail.com> wrote:
> What happens when you do a FilePath.readToString() on a Master/Slave setup?
> Will the master read the contents of the file from the salve and process the contents locally?
I am not sure what you mean by “process” in this context. The master
will send a request to the agent to load the file into a string, and
the agent sends back a response with that string.
Reading between the lines a bit, I think you are asking something like
this: suppose the agent workspace contains some possibly big file and
you only need a little bit of information from it. In that case it is
a bad idea to write
FilePath file = workspace.child("all-results.xml");
String xml = file.readtoString(); // slow!
int count = countNumberOfResults(xml);
The better code would be:
FilePath file = workspace.child("all-results.xml");
int count = file.act(new CountNumberOfResults());
// …
private static final class CountNumberOfResults extends
MasterToSlaveFileCallable<Integer> {…}
so that the response on the Remoting channel just contains the one
integer and not the complete file contents.