app server4rpg - english

77
Introduction RPG Calls Java AppServer4RPG Benchmark Example Inside ArdGate fast, stable and scalable RPG to Java calls Dieter Bender Dieter Bender Inside ArdGate

Upload: common-europe

Post on 16-Jul-2015

256 views

Category:

Technology


9 download

TRANSCRIPT

Page 1: App server4rpg - English

IntroductionRPG Calls JavaAppServer4RPG

Benchmark Example

Inside ArdGatefast, stable and scalable

RPG to Java calls

Dieter Bender

Dieter Bender Inside ArdGate

Page 2: App server4rpg - English

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

[email protected]

Dieter Bender Inside ArdGate

Page 3: App server4rpg - English

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

Page 4: App server4rpg - English

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

Page 5: App server4rpg - English

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

Page 6: App server4rpg - English

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

Page 7: App server4rpg - English

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

Page 8: App server4rpg - English

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

Page 9: App server4rpg - English

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

Page 10: App server4rpg - English

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

Page 11: App server4rpg - English

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

Page 12: App server4rpg - English

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

Page 13: App server4rpg - English

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

Page 14: App server4rpg - English

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

Page 15: App server4rpg - English

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

Page 16: App server4rpg - English

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

Page 17: App server4rpg - English

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

Page 18: App server4rpg - English

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

Page 19: App server4rpg - English

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

Page 20: App server4rpg - English

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

Page 21: App server4rpg - English

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

Page 22: App server4rpg - English

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

Page 23: App server4rpg - English

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

Page 24: App server4rpg - English

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

Page 25: App server4rpg - English

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

Page 26: App server4rpg - English

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

Page 27: App server4rpg - English

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

Page 28: App server4rpg - English

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

Page 29: App server4rpg - English

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

Page 30: App server4rpg - English

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

Page 31: App server4rpg - English

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

Page 32: App server4rpg - English

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

Page 33: App server4rpg - English

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

Page 34: App server4rpg - English

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

Page 35: App server4rpg - English

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

Page 36: App server4rpg - English

IntroductionRPG Calls JavaAppServer4RPG

Benchmark Example

Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern

Hybrid Objects

Plain Old RPGDataStructurePlain Old JavaObject

Dieter Bender Inside ArdGate

Page 37: App server4rpg - English

IntroductionRPG Calls JavaAppServer4RPG

Benchmark Example

Architecture of AppServer4RPGThe EventHandler InterfaceThe PORDS2POJO Pattern

Hybrid Objects

Plain Old RPGDataStructurePlain Old JavaObject

Dieter Bender Inside ArdGate

Page 38: App server4rpg - English

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

Page 39: App server4rpg - English

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

Page 40: App server4rpg - English

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

Page 41: App server4rpg - English

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

Page 42: App server4rpg - English

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

Page 43: App server4rpg - English

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

Page 44: App server4rpg - English

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

Page 45: App server4rpg - English

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

Page 46: App server4rpg - English

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

Page 47: App server4rpg - English

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

Page 48: App server4rpg - English

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

Page 49: App server4rpg - English

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

Page 50: App server4rpg - English

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

Page 51: App server4rpg - English

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

Page 52: App server4rpg - English

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

Page 53: App server4rpg - English

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

Page 54: App server4rpg - English

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

Page 55: App server4rpg - English

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

Page 56: App server4rpg - English

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

Page 57: App server4rpg - English

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

Page 58: App server4rpg - English

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

Page 59: App server4rpg - English

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

Page 60: App server4rpg - English

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

Page 61: App server4rpg - English

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

Page 62: App server4rpg - English

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

Page 63: App server4rpg - English

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

Page 64: App server4rpg - English

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

Page 65: App server4rpg - English

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

Page 66: App server4rpg - English

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

Page 67: App server4rpg - English

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

Page 68: App server4rpg - English

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

Page 69: App server4rpg - English

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

Page 70: App server4rpg - English

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

Page 71: App server4rpg - English

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

Page 72: App server4rpg - English

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

Page 73: App server4rpg - English

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

Page 74: App server4rpg - English

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

Page 75: App server4rpg - English

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

Page 76: App server4rpg - English

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

Page 77: App server4rpg - English

IntroductionRPG Calls JavaAppServer4RPG

Benchmark Example

Generating PDF from HTMLThe RUNJVA WayThe Embedded Java in RPG WayThe Gleiberg Version

Questions?

Dieter Bender Inside ArdGate