commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject [pool][dbcp] Ongoing saga of setFactory
Date Thu, 16 Jun 2011 16:25:10 GMT
Yesterday I fixed some [dbcp] "problems" caused by the new [pool]
requirement that setFactory can only be called once.  The quotes are
because most of the problems were redundant calls to setFactory. 
The reason that we left setFactory in [pool] is that [dbcp]'s
connection factory constructors call setFactory on the pool passed
to them.  It is an easy "mistake" to create a pool, then create a
connection factory and then do pool.setFactory(factory).  I
eliminated all of these usages from within [dbcp], but I bet a fair
amount of user code will similarly blow up when people upgrade.  I
hate to keep backsliding here, but maybe we should to this in GOP
setFactory:

             synchronized (factoryLock) {
                 if (this.factory == null) {
                     this.factory = factory;
-                } else {
+                } else if (this.factory != factory) {
                     throw new IllegalStateException("Factory
already set");
                 }
             }

Phil


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


Mime
View raw message