Hi Viola!

On Jun 29, 2010, at 8:09 PM, viola.lu wrote:

> Hi, david:
> i have some questions about attributes usage: PoolVersion, Flushed, Sweeps,
> and GarbageCollected, these attributes are used under what kinds of
> condition?Thanks in advance!

GarbageCollected is untestable as it will basically only ever increment if 
instances in the pool are garbage collected -- we use SoftReference objects to 
hold all non-min instances.  Hadn't thought of it till now, but maybe calling 
System.gc() might do something.  Not sure if that is reliable enough for a test 
case, but who knows.

Sweeps is how often the pool is "cleaned" and that is controlled by the 
PollInterval setting.

PoolVersion and Flushed are related to the flushing functionality which can be 
triggered by a Stateless bean by obtaining a reference to the SessionContext as 
normal then casting that object to java.io.Flushable and calling the flush() 
method.  We achieve the flushing mechanism by versioning the pool and then 
marking all instances in the pool with that version.  When the pool version 
changes, we see that instances do not match and they are discarded.  The 
PoolVersion essentially tells now many times flush was called and Flushed is 
how many instances total have been flushed in the life of the pool.


-David

Reply via email to