Hi all guys,
there are Generic(Keyed)ObjectPool(Factory) that (in pairs, Pool and
related factory) share the same kind of information, replicated in the
related Config class.

I wonder if we can improve that design and remove that information
redundancy: I propose to keep the Config classes only, put them not as
inner class, in order to remove the circular dependency between
factory/pool and remove also the not so comfortable (at least for me)
n-arguments constructors.
So, the GenericObjectPool, instead of having all these constructors,
could work only with:

public GenericObjectPool(PoolableObjectFactory<T> factory) {
    this(factory, new Config());
}

public GenericObjectPool(PoolableObjectFactory<T> factory, Config config) {
    this.factory = factory;
    this.config = config;
}

both factory and config can be final; if users need to reconfigure the
pool at runtime, invoke the setter and modify the interested value

pool.getConfig().setWhenExhaustedAction(WhenExhaustedAction.GROW);

I'd extend later the same approach also to other Pools... WDYT?
Many thanks in advance,
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to