Thanks for the input.
While there is some cost to spinning a new JVM for a QSH/PASE call, we typically judge based on the amount the specified app will be used.
If it's used in very high speed/high perf apps, we typically use a Tomcat or Jetty server so the server is always up. We use a technique similar to your data queue approach, but we utilize database tables for better resiliency and visibility to data. Or we use REST-style URL calls to run commands.
For small/medium sized single purpose commands for modifying documents we use calls directly to QSH/Pase wrapped by CL. A CL command is perfect for IBM i developers to be able to consume Java without knowing or caring whether it's Java.
I think Java is underutilized on the i.
We also tend to currently favor the 32-bit JVMs which fly......
All of our performance testing is done on low-end machines purposely because if code performs well there, on a larger machine it will smoke.
Either way we are currently avoiding the RPG/JNI mix like the plague for production quality apps :-)
Regards,
Richard Schoen
RJS Software Systems Inc.
Where Information Meets Innovation
Document Management, Workflow, Report Delivery, Forms and Business Intelligence
Email: richard@xxxxxxxxxxxxxxx
Web Site:
http://www.rjssoftware.com
Tel: (952) 736-5800
Fax: (952) 736-5801
Toll Free: (888) RJSSOFT
----------------------------------------------------------------------
message: 1
date: Fri, 29 Mar 2013 14:06:20 +0100
from: "D*B" <dieter.bender@xxxxxxxxxxxx>
subject: Re: no such method error
<Richard>
Rather than calling RPG at all depending on the process, it might be better to write a Java Program/Class and wrap a CL program or command around it.
We do this quite successfully. QSH and PASE get called in the background which is the equivalent of a new JVM being initiated.
We had problems with our RPG/Java mix programs at V7R1 and eliminated RPG from the mix for those.
</Richard>
JNI (Java native interface) was not designed to write mixed applications and the RPG implementation of JNI is really buggy. But your approach to call a Java main from CL in a SBMJOB has severe limitations too. A Java main could only return an integer and all of your Java classes are stateless, as they are initialized at every call and last not least, you are starting a JVM for every call, which would not scale well and is rather expensive on AS/400.
I recommend an asynchronous approach with a prestarted JVM, sitting on a DataQ (or something similar), waiting for incoming calls with some data as parameter, returning some data as response to the calling AS/400 native programm. AppServer4RPG is a sort of extensible Framework to accomplish this. To implement a call of a Java normal non static method, you would need a so called EventHandler and two PORDS2POJO Beans for the incoming and outgoing DataStructure and an entry to the configuration.
AppServer4RPG provides some Session Handling for your EventHandlers and the complete DataQ Handling, it's open source and available at SourceForge. If you would need diffrent JVM configurations, you could easyly start multiple instances of AppServer4RPG, each of them supporting multiple clients at the same time; once started it reacts very fast. To play around with AppServer4RPG you could install ArdGate, an universal database driver to access JDBC databases from AS/400 native SQL interfaces; ArdGate is an application using AppServer4RPG as its base layer.
D*B
------------------------------
--
This is the Java Programming on and around the IBM i (JAVA400-L) digest list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/java400-l.
End of JAVA400-L Digest, Vol 11, Issue 26
*****************************************
As an Amazon Associate we earn from qualifying purchases.