Phil and others interested in Pool and DBCP,

While working on resolving POOL-86 which is about finding a way to
trim the pool size down after a load spike to try to minimize used
resources during off peak load levels.

I've suggested a decorator that wraps a pool and monitors it's usage
and intercepts calls to returnObject and directs them to
invalidateObject occasionally in order to shrink the size of the idle
objects in the pool.

I think this is a good idea because it solves the deadlock issue
described in DBCP-65 when DBCP uses an evictor.

The most crude form of the decorator would implement returnObject
something like:

returnObject(Object obj) {
 if (Math.random() < 0.01) { // 1% of the time
   wrappedPool.invalidateObject(obj);
 } else {
   wrappedPool.returnObject(obj);
 }
}

more intelligent code could take in to account the actual number if
active and idle pooled objects. Hopefully that conveys the idea I'm
thinking of.

This does have flaws in that it does require activity on the pool for
it to work because it wouldn't have it's own thread, but that is also
how it avoids the risk of deadlocks.

Anyone agree or disagree with me that this is a worthy feature.

More info at:
http://issues.apache.org/jira/browse/DBCP-65
http://issues.apache.org/jira/browse/POOL-86

--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to