|
As at V4R4, using JNI with RPG is best suited for people whose idea of a good time is to walk naked over broken glass while lashing themselves with razor wire. All of this taking place in a snowstorm in the midst of a Rochester winter. It is a painful process and I recommend people to wait until the compiler provides more direct support in a later release. That said, if you are really in a masochistic mood, the major problems are concerned with thread safety. Java is inherently multi threaded, RPG is not, and more specifically the runtime is not fully thread safe. The V4R4 support allows RPG to operate in a multi threaded environment by serializing access to the _module_ i.e. once any procedure in a module is active, then no other procedures in that module can be invoked. This causes design problems in a variety of areas including the possibility of encountering a deadly embrace. Here's an example - In thread 1 Proc A in module X calls Proc B in module Y. Meanwhile in thread 2 Proc C in module Z wants to call Proc D in module X. Thread 2 will be made to wait until thread 1 frees the lock on module X. So far so good, but what if thread 1 decides to call Proc E in module Z? That module is locked by thread 2 which can't complete until thread 1 releases its lock which .............. This has an effect on your design - you might be tempted to have one procedure per module for example. This in turn might make you look to using Import/Export to share data between procedures (or ... shudder .... the LDA!) that would otherwise have been global data in the same module. Now you have to worry about the possibility that multiple threads could be trying to update the same piece of data at the same time and the system can't protect you against that. The net of it is that you have to give considerable thought to your design and whether the payoff (compared with say a simple toolbox program call) is worth the effort. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.