Introduction RPG Calls Java AppServer4RPG Benchmark Example Inside ArdGate fast, stable and scalable RPG to Java calls Dieter Bender Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Inside ArdGatefast, stable and scalable
RPG to Java calls
Dieter Bender
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Who is Dieter Bender
WWW.BENDER-DV.DEDieter Bender, 35435 Wettenberg, GermanyAS/400 consultant
Java, SQL, ILE RPG, COBOLApplication integration, Database
Training: Java, SQL, ILE RPGOpen source components
ArdGate: access any database from i with SQLAppServer4RPG: stable, scalable and fast RPG to Javaintegrationsome RPG components
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Architecture
*ARDPGM mustbe nativeJDBC must beJavavery few RPG(blue)lots of Java (red)lots of calls fromRPG to Javamultiple usersno controll ofenvironment
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Why Gleiberg Project?
AppServer4RPGI’m living nearbyopen source toprotect copyrightof a Freelancerresult of > 10years teachingand projectexperience
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Why Gleiberg Project?
AppServer4RPGI’m living nearbyopen source toprotect copyrightof a Freelancerresult of > 10years teachingand projectexperience
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Why Gleiberg Project?
AppServer4RPGI’m living nearbyopen source toprotect copyrightof a Freelancerresult of > 10years teachingand projectexperience
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Who is Dieter BenderArchitecture of ArdGateThe Gleiberg Project
Why Gleiberg Project?
AppServer4RPGI’m living nearbyopen source toprotect copyrightof a Freelancerresult of > 10years teachingand projectexperience
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG is only a Subset of Java
Java is designed for multithreadingJava has lots of high quality open source componentsJava has lots of high quality open source tools RPG doesn’thave for moneyprogrammer productivity with OO languages is by far higher(by same level of experience)some examples:
WebServices and XMLgenerating PDF, HTML and EXCELJDBC access to databases
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG is only a Subset of Java
Java is designed for multithreadingJava has lots of high quality open source componentsJava has lots of high quality open source tools RPG doesn’thave for moneyprogrammer productivity with OO languages is by far higher(by same level of experience)some examples:
WebServices and XMLgenerating PDF, HTML and EXCELJDBC access to databases
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG is only a Subset of Java
Java is designed for multithreadingJava has lots of high quality open source componentsJava has lots of high quality open source tools RPG doesn’thave for moneyprogrammer productivity with OO languages is by far higher(by same level of experience)some examples:
WebServices and XMLgenerating PDF, HTML and EXCELJDBC access to databases
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG is only a Subset of Java
Java is designed for multithreadingJava has lots of high quality open source componentsJava has lots of high quality open source tools RPG doesn’thave for moneyprogrammer productivity with OO languages is by far higher(by same level of experience)some examples:
WebServices and XMLgenerating PDF, HTML and EXCELJDBC access to databases
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG is only a Subset of Java
Java is designed for multithreadingJava has lots of high quality open source componentsJava has lots of high quality open source tools RPG doesn’thave for moneyprogrammer productivity with OO languages is by far higher(by same level of experience)some examples:
WebServices and XMLgenerating PDF, HTML and EXCELJDBC access to databases
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG Calls Java
RUNJVA and QSH CMD(java ...)only Java applications could be calledonly error level is coming backhorrible Overhead
Java stored proceduresonly static methods could be calledin SQL client mode not scalingin SQL server mode no controll over JVM properties
JNI Java native interfacewas designed for C implementation of JVM andimplementation of the Java toolscryptic programming and bad maintainability of codeerror recovery and analysis is complicated
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG Calls Java
RUNJVA and QSH CMD(java ...)only Java applications could be calledonly error level is coming backhorrible Overhead
Java stored proceduresonly static methods could be calledin SQL client mode not scalingin SQL server mode no controll over JVM properties
JNI Java native interfacewas designed for C implementation of JVM andimplementation of the Java toolscryptic programming and bad maintainability of codeerror recovery and analysis is complicated
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
RPG Calls Java
RUNJVA and QSH CMD(java ...)only Java applications could be calledonly error level is coming backhorrible Overhead
Java stored proceduresonly static methods could be calledin SQL client mode not scalingin SQL server mode no controll over JVM properties
JNI Java native interfacewas designed for C implementation of JVM andimplementation of the Java toolscryptic programming and bad maintainability of codeerror recovery and analysis is complicated
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
Why I Don’t Like Embedded Java in RPG
controll of the Java environment is near to impossible, becausethe JVM is started automaticallyusing normal Java components produces embedded Java inRPGthese programms are hard to develop, debug and maintainfirst call is very slow and starting hundreds or thousands JVMmakes IBM happy, but doesn’t scale wellthe implementation of the JNI support in the RPG compiler isbuggy and crashing JVMs are not recovereable! (BTW: neversaw a crashing JVM outside the JNI support of RPG!!!)too much programming effort for suboptimal results
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
Why I Don’t Like Embedded Java in RPG
controll of the Java environment is near to impossible, becausethe JVM is started automaticallyusing normal Java components produces embedded Java inRPGthese programms are hard to develop, debug and maintainfirst call is very slow and starting hundreds or thousands JVMmakes IBM happy, but doesn’t scale wellthe implementation of the JNI support in the RPG compiler isbuggy and crashing JVMs are not recovereable! (BTW: neversaw a crashing JVM outside the JNI support of RPG!!!)too much programming effort for suboptimal results
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
Why I Don’t Like Embedded Java in RPG
controll of the Java environment is near to impossible, becausethe JVM is started automaticallyusing normal Java components produces embedded Java inRPGthese programms are hard to develop, debug and maintainfirst call is very slow and starting hundreds or thousands JVMmakes IBM happy, but doesn’t scale wellthe implementation of the JNI support in the RPG compiler isbuggy and crashing JVMs are not recovereable! (BTW: neversaw a crashing JVM outside the JNI support of RPG!!!)too much programming effort for suboptimal results
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
Why I Don’t Like Embedded Java in RPG
controll of the Java environment is near to impossible, becausethe JVM is started automaticallyusing normal Java components produces embedded Java inRPGthese programms are hard to develop, debug and maintainfirst call is very slow and starting hundreds or thousands JVMmakes IBM happy, but doesn’t scale wellthe implementation of the JNI support in the RPG compiler isbuggy and crashing JVMs are not recovereable! (BTW: neversaw a crashing JVM outside the JNI support of RPG!!!)too much programming effort for suboptimal results
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
Why I Don’t Like Embedded Java in RPG
controll of the Java environment is near to impossible, becausethe JVM is started automaticallyusing normal Java components produces embedded Java inRPGthese programms are hard to develop, debug and maintainfirst call is very slow and starting hundreds or thousands JVMmakes IBM happy, but doesn’t scale wellthe implementation of the JNI support in the RPG compiler isbuggy and crashing JVMs are not recovereable! (BTW: neversaw a crashing JVM outside the JNI support of RPG!!!)too much programming effort for suboptimal results
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Why is this Important?Ways to Call Java from RPGRPGs JNI Support
Why I Don’t Like Embedded Java in RPG
controll of the Java environment is near to impossible, becausethe JVM is started automaticallyusing normal Java components produces embedded Java inRPGthese programms are hard to develop, debug and maintainfirst call is very slow and starting hundreds or thousands JVMmakes IBM happy, but doesn’t scale wellthe implementation of the JNI support in the RPG compiler isbuggy and crashing JVMs are not recovereable! (BTW: neversaw a crashing JVM outside the JNI support of RPG!!!)too much programming effort for suboptimal results
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Architecture Overview
one residentJVM servesmultiple RPGclientsasynchronouscommunicationextendableEventHandlerconceptRPG sends andreceivesDataStructure(translated byJava)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Architecture Overview
one residentJVM servesmultiple RPGclientsasynchronouscommunicationextendableEventHandlerconceptRPG sends andreceivesDataStructure(translated byJava)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Architecture Overview
one residentJVM servesmultiple RPGclientsasynchronouscommunicationextendableEventHandlerconceptRPG sends andreceivesDataStructure(translated byJava)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Architecture Overview
one residentJVM servesmultiple RPGclientsasynchronouscommunicationextendableEventHandlerconceptRPG sends andreceivesDataStructure(translated byJava)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
The RPG Perspective
RPG calls Javamethodread as:outDS =ARDPGM(inDS)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
The RPG Perspective
RPG calls Javamethodread as:outDS =ARDPGM(inDS)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
The Java Perspective
Action: whatshould be called?how has thehandler to looklike?
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
The Java Perspective
Action: whatshould be called?how has thehandler to looklike?
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Hybrid Objects
Plain Old RPGDataStructurePlain Old JavaObject
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Hybrid Objects
Plain Old RPGDataStructurePlain Old JavaObject
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Translation Objects
PORDS2POJO:= a Java object, encapsulating thetranslation between the binary representation of a PORDS anda POJO
POJO with all components of the PORDS as Java typesobject variable to hold the PORDS ( private byte[] huddle )setter and getter for the binary huddlethis Hybrid objects always reflect the Java and the RPGperspective of the same datasometimes only on direction is needed and implemented
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Translation Objects
PORDS2POJO:= a Java object, encapsulating thetranslation between the binary representation of a PORDS anda POJO
POJO with all components of the PORDS as Java typesobject variable to hold the PORDS ( private byte[] huddle )setter and getter for the binary huddlethis Hybrid objects always reflect the Java and the RPGperspective of the same datasometimes only on direction is needed and implemented
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Translation Objects
PORDS2POJO:= a Java object, encapsulating thetranslation between the binary representation of a PORDS anda POJO
POJO with all components of the PORDS as Java typesobject variable to hold the PORDS ( private byte[] huddle )setter and getter for the binary huddlethis Hybrid objects always reflect the Java and the RPGperspective of the same datasometimes only on direction is needed and implemented
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Translation Objects
PORDS2POJO:= a Java object, encapsulating thetranslation between the binary representation of a PORDS anda POJO
POJO with all components of the PORDS as Java typesobject variable to hold the PORDS ( private byte[] huddle )setter and getter for the binary huddlethis Hybrid objects always reflect the Java and the RPGperspective of the same datasometimes only on direction is needed and implemented
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern
Translation Objects
PORDS2POJO:= a Java object, encapsulating thetranslation between the binary representation of a PORDS anda POJO
POJO with all components of the PORDS as Java typesobject variable to hold the PORDS ( private byte[] huddle )setter and getter for the binary huddlethis Hybrid objects always reflect the Java and the RPGperspective of the same datasometimes only on direction is needed and implemented
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
A Real Life Example
The idea: RPG application generates a HTML invoiceJava generates from the HTML and a CSS a PDF invoicethe Java Part is done by iText and Flying SaucerRequirement: 10.000 invoices in 6 hfirst customer evaluation: 30 sec. up to minutes for 1!my first evaluation on Wintel: subsecond!
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
A Real Life Example
The idea: RPG application generates a HTML invoiceJava generates from the HTML and a CSS a PDF invoicethe Java Part is done by iText and Flying SaucerRequirement: 10.000 invoices in 6 hfirst customer evaluation: 30 sec. up to minutes for 1!my first evaluation on Wintel: subsecond!
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
A Real Life Example
The idea: RPG application generates a HTML invoiceJava generates from the HTML and a CSS a PDF invoicethe Java Part is done by iText and Flying SaucerRequirement: 10.000 invoices in 6 hfirst customer evaluation: 30 sec. up to minutes for 1!my first evaluation on Wintel: subsecond!
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
A Real Life Example
The idea: RPG application generates a HTML invoiceJava generates from the HTML and a CSS a PDF invoicethe Java Part is done by iText and Flying SaucerRequirement: 10.000 invoices in 6 hfirst customer evaluation: 30 sec. up to minutes for 1!my first evaluation on Wintel: subsecond!
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
A Real Life Example
The idea: RPG application generates a HTML invoiceJava generates from the HTML and a CSS a PDF invoicethe Java Part is done by iText and Flying SaucerRequirement: 10.000 invoices in 6 hfirst customer evaluation: 30 sec. up to minutes for 1!my first evaluation on Wintel: subsecond!
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
HTML2PDF4I by Aaron Bartell
Article in IBM Systems MagazineOpen Source at http://mowyourlawn.comJava Application as a wrapper for iText and Flying Saucercalled by RPG programm via RUNJVA with assembledclasspath settingmy evaluation 10 sec.
opening a Job for each call of RUNJVA and starting a JVMslow, but scaling linear - JVM is closed after call.
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
HTML2PDF4I by Aaron Bartell
Article in IBM Systems MagazineOpen Source at http://mowyourlawn.comJava Application as a wrapper for iText and Flying Saucercalled by RPG programm via RUNJVA with assembledclasspath settingmy evaluation 10 sec.
opening a Job for each call of RUNJVA and starting a JVMslow, but scaling linear - JVM is closed after call.
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
HTML2PDF4I by Aaron Bartell
Article in IBM Systems MagazineOpen Source at http://mowyourlawn.comJava Application as a wrapper for iText and Flying Saucercalled by RPG programm via RUNJVA with assembledclasspath settingmy evaluation 10 sec.
opening a Job for each call of RUNJVA and starting a JVMslow, but scaling linear - JVM is closed after call.
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Classpath Problem
first problem: you will need 3 jar files in your classpathstarting the JVM at Job begin => a JVM is started, butmaybe not usedstarting the JVM before usage => might fail, because startedbeforesubmitting a job for usage => same problem as RUNJVA withmore effort!setting global classpath => might interfere with otherapplicationsusing extdir => even worse, has higher priority than classpathsetting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Classpath Problem
first problem: you will need 3 jar files in your classpathstarting the JVM at Job begin => a JVM is started, butmaybe not usedstarting the JVM before usage => might fail, because startedbeforesubmitting a job for usage => same problem as RUNJVA withmore effort!setting global classpath => might interfere with otherapplicationsusing extdir => even worse, has higher priority than classpathsetting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Classpath Problem
first problem: you will need 3 jar files in your classpathstarting the JVM at Job begin => a JVM is started, butmaybe not usedstarting the JVM before usage => might fail, because startedbeforesubmitting a job for usage => same problem as RUNJVA withmore effort!setting global classpath => might interfere with otherapplicationsusing extdir => even worse, has higher priority than classpathsetting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Classpath Problem
first problem: you will need 3 jar files in your classpathstarting the JVM at Job begin => a JVM is started, butmaybe not usedstarting the JVM before usage => might fail, because startedbeforesubmitting a job for usage => same problem as RUNJVA withmore effort!setting global classpath => might interfere with otherapplicationsusing extdir => even worse, has higher priority than classpathsetting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Classpath Problem
first problem: you will need 3 jar files in your classpathstarting the JVM at Job begin => a JVM is started, butmaybe not usedstarting the JVM before usage => might fail, because startedbeforesubmitting a job for usage => same problem as RUNJVA withmore effort!setting global classpath => might interfere with otherapplicationsusing extdir => even worse, has higher priority than classpathsetting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Why I Gave Up
second problem: for one java statement you need multipleRPG declarations and statements.
10 minutes programming java <=> one day programmingembedded Java in RPG
third problem: hard to read debug and even worse inproduction!
impossible to use log4j
maybe faster for subsequent calls in the same job thanRUNJVAscalability even worse (the programm could be called in everyJob!)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Why I Gave Up
second problem: for one java statement you need multipleRPG declarations and statements.
10 minutes programming java <=> one day programmingembedded Java in RPG
third problem: hard to read debug and even worse inproduction!
impossible to use log4j
maybe faster for subsequent calls in the same job thanRUNJVAscalability even worse (the programm could be called in everyJob!)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Why I Gave Up
second problem: for one java statement you need multipleRPG declarations and statements.
10 minutes programming java <=> one day programmingembedded Java in RPG
third problem: hard to read debug and even worse inproduction!
impossible to use log4j
maybe faster for subsequent calls in the same job thanRUNJVAscalability even worse (the programm could be called in everyJob!)
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The RPG Perspective
what we wantinstallAppServer4RPGimplement the call
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The RPG Perspective
what we wantinstallAppServer4RPGimplement the call
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The RPG Perspective
what we wantinstallAppServer4RPGimplement the call
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Closing the Chain to Java
now we need anEventHandler to becalledconfigureAppServer4RPG
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Closing the Chain to Java
now we need anEventHandler to becalledconfigureAppServer4RPG
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
What Happens Now Calling the RPG Programm?
the RPG part puts its input parameters to the request DS andcalls fireEventPthe RPG part of JVAGATE creates a response DTAQsends the data (and an identifier for the caller Job) inpackages to the JAVAQlistens on the responseQ for the answerNow the Java part of AppServer4RPG does its work (hopefullyit was started)
starts a new worker Thread to be ready for the next requestcreates a Handler for the requested Event,creates Request and Response Objects and calls theperformWork of the Handlersends the response Data back in packages to the ResponseQ.known by the identifier passed with the request
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
What Happens Now Calling the RPG Programm?
the RPG part puts its input parameters to the request DS andcalls fireEventPthe RPG part of JVAGATE creates a response DTAQsends the data (and an identifier for the caller Job) inpackages to the JAVAQlistens on the responseQ for the answerNow the Java part of AppServer4RPG does its work (hopefullyit was started)
starts a new worker Thread to be ready for the next requestcreates a Handler for the requested Event,creates Request and Response Objects and calls theperformWork of the Handlersends the response Data back in packages to the ResponseQ.known by the identifier passed with the request
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
What Happens Now Calling the RPG Programm?
the RPG part puts its input parameters to the request DS andcalls fireEventPthe RPG part of JVAGATE creates a response DTAQsends the data (and an identifier for the caller Job) inpackages to the JAVAQlistens on the responseQ for the answerNow the Java part of AppServer4RPG does its work (hopefullyit was started)
starts a new worker Thread to be ready for the next requestcreates a Handler for the requested Event,creates Request and Response Objects and calls theperformWork of the Handlersends the response Data back in packages to the ResponseQ.known by the identifier passed with the request
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The EventHandler
gets a Requesta simplePORDS2POJObinary is set withConstructorgetter for propertiesthe EventHandler
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The EventHandler
gets a Requesta simplePORDS2POJObinary is set withConstructorgetter for propertiesthe EventHandler
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The EventHandler
gets a Requesta simplePORDS2POJObinary is set withConstructorgetter for propertiesthe EventHandler
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Results
Transaction Times of subsecondsfirst call in a Job as fast as following (JVM is prestarted)very scalable (one JVM serves multiple RPG Jobs)no Classpath issues, simply throw the needed jar files to the libdirectory of AppServer4RPGmultiple instances of AppServer4RPG could run on the samebox with diffrent JVM settingsAppServer4RPG could be installed on a dedicated serverless programming effort than embedded Java in RPGflexible logging with log4j simplifies trouble shooting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Results
Transaction Times of subsecondsfirst call in a Job as fast as following (JVM is prestarted)very scalable (one JVM serves multiple RPG Jobs)no Classpath issues, simply throw the needed jar files to the libdirectory of AppServer4RPGmultiple instances of AppServer4RPG could run on the samebox with diffrent JVM settingsAppServer4RPG could be installed on a dedicated serverless programming effort than embedded Java in RPGflexible logging with log4j simplifies trouble shooting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Results
Transaction Times of subsecondsfirst call in a Job as fast as following (JVM is prestarted)very scalable (one JVM serves multiple RPG Jobs)no Classpath issues, simply throw the needed jar files to the libdirectory of AppServer4RPGmultiple instances of AppServer4RPG could run on the samebox with diffrent JVM settingsAppServer4RPG could be installed on a dedicated serverless programming effort than embedded Java in RPGflexible logging with log4j simplifies trouble shooting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Results
Transaction Times of subsecondsfirst call in a Job as fast as following (JVM is prestarted)very scalable (one JVM serves multiple RPG Jobs)no Classpath issues, simply throw the needed jar files to the libdirectory of AppServer4RPGmultiple instances of AppServer4RPG could run on the samebox with diffrent JVM settingsAppServer4RPG could be installed on a dedicated serverless programming effort than embedded Java in RPGflexible logging with log4j simplifies trouble shooting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Results
Transaction Times of subsecondsfirst call in a Job as fast as following (JVM is prestarted)very scalable (one JVM serves multiple RPG Jobs)no Classpath issues, simply throw the needed jar files to the libdirectory of AppServer4RPGmultiple instances of AppServer4RPG could run on the samebox with diffrent JVM settingsAppServer4RPG could be installed on a dedicated serverless programming effort than embedded Java in RPGflexible logging with log4j simplifies trouble shooting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
The Results
Transaction Times of subsecondsfirst call in a Job as fast as following (JVM is prestarted)very scalable (one JVM serves multiple RPG Jobs)no Classpath issues, simply throw the needed jar files to the libdirectory of AppServer4RPGmultiple instances of AppServer4RPG could run on the samebox with diffrent JVM settingsAppServer4RPG could be installed on a dedicated serverless programming effort than embedded Java in RPGflexible logging with log4j simplifies trouble shooting
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Summary
Don’t try to write Java code in RPG, provide Java methodswith Datastructure parameter interfaces for RPG usage!Let your Java Code run in a prestarted resident JVM,communicating asynchronous with your native programms.
Outlook (Nice to have!)Dynamic PORDS2POJO Beans.True Tomcat Version of AppServer4RPG.
Dieter Bender Inside ArdGate
IntroductionRPG Calls JavaAppServer4RPG
Benchmark Example
Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version
Questions?
Dieter Bender Inside ArdGate