Are you talking about database connections or connections to run native commands and programs?

JDBC connections use JT400.jar (JTOPEN.jar) and classes from the jre. I doubt you're replacing any of those. What jars are failing to replace? Are they your own code?

If you are using the non-thread-safe versions of the connection commands, those connections occur in jni programs that run within the same job as the jvm. The thread-safe versions are all native java and jdk code communicating with server jobs that usually run in the QUSRWRK subsystem. That might make a difference when trying to shut down the jvm via the activation group to free up connections to your jar files.

Just as an afterthought, are you doing anything to your java environment that would free up hard links before you end the activiation group?

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Anna Abt
Sent: Tuesday, November 02, 2010 7:33 AM
To: 'Java Programming on and around the IBM i'
Subject: RE: .jar files in use on a restore

The activation group is ended at the end of the rpg processes and also ended at the beginning of an install/upgrade. As this seems to be intermittent and a fairly new occurrence, I'm leaning toward something the java code is doing in creating an iSeries connection. I am running more tests on our systems to see if I can get more details.


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dan Kimmel
Sent: Monday, November 01, 2010 6:06 PM
To: Java Programming on and around the IBM i
Subject: RE: .jar files in use on a restore

As long as that RPG program has pointers to the instantiated object, you're not going to be able to replace the jars containing the code for that object. There are other ways to do it, but you're probably going to have to end the activation group where the RPG program is running in order to remove the locks on the jar files. I don't think the traditional methods of detecting locks are going to find locks on your jar files. WRKOBJLCK, for instance, looks for objects referenced by the job and a jar file is not an object. However, the file is "in use".

When RPG uses a java method, RPG invokes the JVM and the JVM "opens" the jar files. The JVM doesn't need the jar file anymore after the class and object are instantiated in memory and might close it, except for garbage collection. The JVM must hold a lock on the jar file as long as it is running as it might need to read the class from the jar again if garbage collection has removed the class object when RPG needs to build a new instance.

Depending on the operating system level, the jvm may run in a separate job.
In any case it is a unique thread or threads whether in the same job as the RPG or in its own job. All the stuff that connects the RPG to the jvm is in an activation group. If you have the RPG program running in some activation group outside the default activation group, the jvm-glue probably runs in the same activation group. If your RPG program is running in the default activation group all that glue is probably in its own activation group. I say probably here, because I'm reporting behavior as I see it; I don't actually have documentation on this.

So my take on how to do the upgrade you describe would be to have the CL that runs the RPG program end the activation group that contains the RPG program; do the jar file replaces; then start the RPG program back up again.
This should work in just about all operating systems and versions of java.

Anyone else care to contribute?

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Anna Abt
Sent: Monday, November 01, 2010 4:07 PM
To: 'Java Programming on and around the IBM i'
Subject: RE: .jar files in use on a restore

There was no OS upgrade or PTF applied on our systems since the problem started, I do not know about clients. We run v5r3, v5r4, and v5r6 here and
support back to v5r2 for our customer base. RPG invokes the jvm and sets
the class path and environmental variables and begins and ends the object group. RPG calls the methods within an instantiated object. Before any upgrades locks on all rpg objects are checked and the upgrade will not continue if it cannot allocate all objects. The basic processing on the rpg side has been the same for a number of years. Some java methods were connecting to the iSeries for data retrieval.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dan Kimmel
Sent: Monday, November 01, 2010 4:28 PM
To: Java Programming on and around the IBM i
Subject: RE: .jar files in use on a restore

I think the connection pool is a red herring. The problem probably has more to do with an OS upgrade or PTF applied in the last year. I'd need to know a lot more to offer any other suggestions. What OS version? What kind of programs use the jar files? How is the jvm invoked? Where does the rpg program enter the picture? Is the rpg program calling methods on objects in the jar files? Do you stop all instances of the rpg program before attempting to replace the jar files?

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Anna Abt
Sent: Monday, November 01, 2010 2:38 PM
To: java400-l@xxxxxxxxxxxx
Subject: .jar files in use on a restore

Recently we have run into an issue when trying to run upgrades of our software. I have a clle program that does a restore to an ifs directory with new .jar files. There have been instances lately where objects have not been restored because they are in use. Speaking with our java programmers I did learn that there was a change made in the past year to create a connection pool and keep it open for a longer period of time for performance enhancing reasons. Doing some testing, we removed the connection and are now sending the data from the rpg programs to the java methods. We are still finding that the .jar files stay in a "in use" state.
Can anyone tell me how we might get around this or why this seems to be happening all of a sudden? We even did a simple test adding a classpath of
3 .jar files and running 2 programs, the first opens a connection and prints and the second closes the connection. Those 3 files still are in use and unable to run a restore against.







--
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.



--
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.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 5583 (20101101) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



--
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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.