|
If I am not mistaken, this sample shows how to attach to previously started JVM in the same job (if JVM was already started for this job, it is reasonable to reuse it). I do not think you can attach to any JVM on system. Alexei Pytel always speaking for myself "Christopher J. Jewell" To: <java400-l@midrange.com> <jewellcj@jewellc cc: onsult.com> Subject: FW: java to RPG problem Sent by: java400-l-admin@m idrange.com 12/11/2002 08:01 PM Please respond to java400-l >>Naturally I disagree with James' comments about Java! I meant to say that I disagree with James' comments about RPG also: I guess I need hardly say that ILE/RPG is a terrific and elegant language, superb for programmer productivity and well-suited to heavy duty database transaction processing native on the iSeries. The integration features with Java are extremely well done - the only issue with Java integration that I can see is the necessity to serialize for thread-blocking at the level of the module (as mentioned earlier). When it comes to calling Java from RPG, however, I need to be reassured that it is possible for an ILE RPG procedure to call into a specific instance of a JVM running in OS/400 - for example a WebSphere Application Server Instance. The RPG Programmers manual has the following rather obscure code for finding an existing running JVM: * * See if there's a JVM started C Eval rc = JNI_GetCreatedJavaVMs( C jvm : bufLen: nVMs) * * If JVM is started, just attach to it to get the env pointer. C If rc = 0 C and nVMs > 0 C Eval attachArgs = *ALLX'00' C Eval JavaVM_P = jvm(1) C Eval rc = AttachCurrentThread (jvm(1) : C env : %addr(attachArgs)) * * If JVM is not started, start it with the default class path. C Else C Eval initArgs = *ALLX'00' C Eval rc = JNI_GetDefaultJavaVMInitArgs( C %addr(initArgs)) C If rc = 0 C Eval rc = JNI_CreateJavaVM(jvm(1) : env: C %addr(initArgs) ) C EndIf C EndIf The question is: how can the program know which is the correct JVM to attach to? For example, there may be a requirement always to attach to a given WAS JVM instance. I suppose an alternative would be to customize the WAS instance, on start up, to call out to RPG in order to insure that the WAS instance is known to RPG. Maybe I'm way off-base here - if so, can someone let me know! Chris Jewell _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.