You have to remember that a JVM takes a long time to fire up and load classes. Once it's up and running, it is very quick. It trades memory for processing time. That is, it takes a long time to load up memory but once memory is loaded it can be very, very quick.
You do not want to be loading a JVM for each transaction from your scale!
It is not unusual to see long response times like you show for the first transaction. Subsequent transactions should be very quick as long as the JVM does not have to be reloaded. Still, you need to be careful that you are allocating enough memory space for the JVM.
What kind of machine are you running? What subsystem is running the job? How is the job routed to a memory pool? How big is the memory pool. Do you have any memory constraints set in java properties Xms and Xmx?
I've not used data areas in such a transaction. I'd have the java put the info in a dataqueue. Then I'd have the CL, running in a different job, camp on the dataqueue. There are many other techniques for communicating job-to-job besides program calls. You might even have the java code call the CL.
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve Fekete
Sent: Tuesday, October 16, 2012 12:36 PM
To: JAVA400-L@xxxxxxxxxxxx
Subject: RE: How do I keep JVM open after first call?
Thanks for the response folks.
I have included a debug log below that I ran the other day.
I'll try to give more detail now. I have a CL calling a Java program that
is doing a sockets to a weight scale on my network. The Java program
retrieves the weight fairly quick. The program then opens a connection to
the iSeries and does a CHGDTAARA command to put the weight in the data area.
I then, in the CL, retrieve the weight and the program goes on its way.
As you can see towards the bottom of the log, it takes 5 seconds for the connection to the iSeries and then 5 more to do the CHGDTAARA.
Sorry if this is NOT the way to post log files...I searched for the a way to post the text file in here instead, but I didn't find anything.
2012-10-12-17.03.11.264000: ScaleTools.main - Param #1: 216.27.204.50
2012-10-12-17.03.11.403000: ScaleTools.main - Param #2: 6001
2012-10-12-17.03.11.406000: ScaleTools.main - Param #3:
2012-10-12-17.03.11.407000: ScaleTools.main - Param #4: 1
2012-10-12-17.03.11.408000: ScaleTools.main - Param #5: 1
2012-10-12-17.03.11.524000: WriteToDBFile - Register DB driver
com.ibm.db2.jdbc.app.DB2Driver
2012-10-12-17.03.11.526000: ScaleTools.main - Calling ScaleRead ...
2012-10-12-17.03.11.527000: Calling SocketWrite ...
2012-10-12-17.03.11.528000: SocketWrite - Create an instance of socket to
216.27.204.50, port 6001
2012-10-12-17.03.11.950000: SocketWrite - Set socket timeout to 5000
2012-10-12-17.03.11.951000: SocketWrite - Create an instance of
BufferedWriter
2012-10-12-17.03.11.963000: SocketWrite - Write [W
] thru the socket connection established ...
2012-10-12-17.03.11.964000: SocketWrite - BufferedWriter flushes ...
2012-10-12-17.03.11.964000: SocketWrite - Verifying if data ready to read
from scale ...
2012-10-12-17.03.12.242000: SocketWrite - Data is ready ...
2012-10-12-17.03.12.243000: SocketWrite - Create an instance of
BufferedReader
2012-10-12-17.03.12.246000: SocketWrite - Reading from scale ...
2012-10-12-17.03.12.257000: SocketWrite - Complete data from scale: 005.20
2012-10-12-17.03.12.258000: SocketWrite - Reading from scale done
2012-10-12-17.03.12.259000: Value returned from SocketWrite: 005.20
? to double ....12.260000: Converting 005.20
2012-10-12-17.03.12.275000: Converted value: 5.2
2012-10-12-17.03.12.276000: Establishing a new connection to 192.168.249.2
...
2012-10-12-17.03.17.093000: Establishing a new connection to 192.168.249.2
Done
2012-10-12-17.03.17.101000: Executing CHGDTAARA DTAARA(PFSSFEKETE)
VALUE(5.2) ...
2012-10-12-17.03.23.959000: Executing CHGDTAARA DTAARA(PFSSFEKETE)
VALUE(5.2) OK
2012-10-12-17.03.23.960000: Leaving the connection to 192.168.249.2 open
2012-10-12-17.03.23.961000: ScaleTools.main - Calling ScaleRead DONE
Java program completed
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing 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.
As an Amazon Associate we earn from qualifying purchases.