Re: [Py4j-users] getting the java gateway to unblock after method call
Status: Beta
Brought to you by:
barthe
From: Barthelemy D. <ba...@cs...> - 2011-12-30 10:00:40
|
Hi Aaron, Sorry for the delay! First, make sure that the java method is indeed blocking. For example, try to get the return value and print it on the python side. Even if the method is void on the Java side, Python will receive a None (there is no "void" in Python). Second, there are two workarounds. Py4J is multi-threaded so you could create multiple threads on the python side and, using the same gateway instance, call multiple blocking Java methods. This is the way to go if you have only a few, short blocking calls. The other workaround is on the Java side: you need to make the method non-blocking, e.g., by launching the app in a thread. Hope this helps, Barthélémy On Wed, December 28, 2011 2:56 pm, Aaron Elder wrote: > I have a method on the java side that launches a java app. If I call this > java method from the python side, the app launches properly, but I am not > able to call any further java methods from the python side. I assume the > gateway is blocking because it thinks the first method called has not > finished execution.What is the recommended way to work around this? > ------------------------------------------------------------------------- > ----- > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! > http://p.sf.net/sfu/Citrix-VDIinabox_____________________________________ > __________ > Py4j-users mailing list > Py4...@li... > https://lists.sourceforge.net/lists/listinfo/py4j-users > > |