[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-user
Subject:    [Pool] Refreshing the pools
From:       "Gardner, Arthur" <arthur.gardner () metlife ! com>
Date:       2020-03-16 20:16:24
Message-ID: BN6P173MB00196E8842B4FAB3FD6BC0D480F90 () BN6P173MB0019 ! NAMP173 ! PROD ! OUTLOOK ! COM
[Download RAW message or body]


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 t=
o 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 re=
starting the JVM.

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

And on my laptop, it does.


Set up a test program and input data, so that I can easily tell what versio=
n 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 fr=
om 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 th=
ere are two pools, and accordingly my reset scripts executes two main() met=
hods, 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 th=
e intended addressee only.  Any unauthorized use, dissemination of the info=
rmation, or copying of this message is prohibited.  If you are not the inte=
nded addressee, please notify the sender immediately and delete this messag=
e.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic