-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronous calls #45
Comments
Please show some code that explains how you "call normal method asynchronously". |
I'm calling pyro methods from handlers of an API. In the example below public class ExternPythonPyro {
PyroProxy pyro;
public ExternPythonPyro() throws Exception {
NameServerProxy ns = NameServerProxy.locateNS(null);
pyro = new PyroProxy(ns.lookup("python-learning-agent"));
ns.close();
}
public void learn(Object input) throws Exception {
pyro.call_oneway("learn", input);
}
public Integer predict(Object input) throws Exception {
return (Integer) pyro.call("predict", input);
}
public void destroy() throws Exception {
pyro.close();
}
}
Is this the case only for Pyrolite or it's a limitation of Pyro in general? Thanks a lot |
It's just the way the underlying socket connections work: they're fully synchronous (blocking) request/replies. The thread using a socket to do a request sits waiting for the response to come back over the same socket. Other threads interfering with the same socket will destroy the integrity of the communication (hence the sequence number check). Pyro (the python library) does internal locking in its proxies for you. Pyrolite doesn't so you should lock yourself. Or make a pool of proxies where you allocate one per thread. |
Hello there,
I'm getting
PyroException("result msg out of sync")
when calling normal method asynchronously from Java. Is there any way to bypass thesequenceNr
checking or is this required for mapping each "result msg" to the callee?Thanks for the great work! :)
The text was updated successfully, but these errors were encountered: