Question about java

Any IBM i topic that does not fit in another forum
Post Reply
GiovanniMeazza
Posts: 1
Joined: Fri Sep 16, 2022 1:29 pm

Question about java

Post by GiovanniMeazza »

Hello, first of all, i'd like to thank you Scott for everything you've done for all the community of developer, your help is always precious.
Thereafter, i'm facing a doubt on the best way to develop a new procedure which has to use and keep alive a java virtual machine, i know java methods can be used directly from rpg and also invoked from qshell, but i'm not able to find the difference regarding performance and impact on system resources between this two methods.
Any suggestion is appreciated,or also, if anyone has a suggestion on how to test the system impact of jvm and java procedure is well accepted.
Thanks all
Bye
jonboy49
Posts: 206
Joined: Wed Jul 28, 2021 8:18 pm

Re: Question about java

Post by jonboy49 »

The JVM is tied to the job and lives only as long as the job. That is the biggest issue most people face.

For a long running "service" provided in Java most submit a never-ending-job to batch and interact with it via data queues. There is an open source engine for this - but I'm danged if I can recall the name and have to go out now. Will try and lopcate it on my return.
jonboy49
Posts: 206
Joined: Wed Jul 28, 2021 8:18 pm

Re: Question about java

Post by jonboy49 »

Just remembered. It is AppServer4RPG and you can find it here: https://sourceforge.net/projects/appserver4rpg/

Great tool.
Scott Klement
Site Admin
Posts: 653
Joined: Sun Jul 04, 2021 5:12 am

Re: Question about java

Post by Scott Klement »

Also, calling Java from RPG is done using the Java Invocation API, which can disable certain types of optimization -- and therefore can negatively affect performance.

The "best" way to do this is to run the Java code in an application server, and code it as a REST API that you can call from your RPG code. Alternately, you can do something similar with data queues, etc... but keep in mind that this will make it proprietary (data queues are not cross-platform or available to all programming environments.)
Post Reply