You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Gardner, Arthur" <ar...@metlife.com> on 2020/03/16 20:16:24 UTC

[Pool] Refreshing the pools

Hi!  I am using commons-pool2 to solve this type of problem:

We use a "program" to translate data from one form to another.

The program is in the form of "source code" in a file.  It is inefficient to load and "compile" every time we use the feature.

So we give each "program" a name, tied to its file name in the OS.

That name becomes the key in a KeyedObjectPool<String,MyCompiledObject>.

When a new object is needed for the pool, I fetch the code and compile it.

I works great.

Next, of course, somebody wants a way to update the source file, without restarting the JVM.

OK, so I figure that pool.clear() or pool.clear(String key) should do the job.

And on my laptop, it does.


Set up a test program and input data, so that I can easily tell what version of the program ran, by looking at the output

Single-stepping, get an object (program) with key X, and run on the input

Change the source file

Run the same data, again fetching an object with key X

. as expected, the old output appears - the precompiled program was used from the pool

Execute clear() on the pool

Repeat the test a third time

. the output shows that the altered program was used

But on the server, it's not happening.

This in WebSphere 8.5.5 on Red Hat Linux 7,  Java 8.

I am only using commons-pool2-2.4.1 currently ... if I jump too far ahead, I can get involved in maven madness, as part of a big company.

There are two apps (.ear files), each with a copy of my jar, so I expect there are two pools, and accordingly my reset scripts executes two main() methods, one per EAR.

I believe that, by relocating my jar as a WebSphere library, I could end up with only one pool, but I don't feel that we need that.

Anyhow, I'm really asking whether anyone has encountered this situation, in which you can't really refresh the pools without a jvm restart.

Thanks,
Arthur


The information contained in this message may be CONFIDENTIAL and is for the intended addressee only.  Any unauthorized use, dissemination of the information, or copying of this message is prohibited.  If you are not the intended addressee, please notify the sender immediately and delete this message.