Implement DataSource. Enough said :)
Logged In: YES
It would be excellent if ProxoolDataSource offered a
simple "close" or "shutdown" method (without parameters),
possibly delegating to ConnectionPoolManager to remove the
pool with the given alias. Jakarta Commons DBCP's
BasicDataSource offers such a "close" method.
In particular, such a shutdown method allows for easier
integration into the Spring Framework: You can declaratively
specify a "destroy-method" there, allowing to take a
DataSource implementation as-is and plug it into Spring's
A further issue I've noticed is the use of synchronization in
ProxoolDataSource.getConnection: Just the registerPool
method is synchronized, but not the check for pool existence.
IMO, both the isPoolExists call and the registerPool call need
to be in the same synchronized block.
Finally, when do you expect to release Proxool 0.9.0 including
the ProxoolDataSource? As soon as that happens, I'll test it
with Spring and include an implementation of Spring's
NativeJdbcExtractor interface for Proxool. (We already do so
for Commons DBCP and XAPool.)
Logged In: YES
We can provide the additional shutdown() method without a
problem. To be clear: this would be like
ProxoolFacade.shutdown(int delay) but use a delay of zero
WRT synchronization of the isPoolExists: we need to think
about that a bit. It is called for every served connection
so we have to think about performance. Might need to
approach it from a different angle, but the weakness is noted.
Proxool 0.9.0RC1 will probably be released around the last
week of April.
We are very happy for you to include Proxool in an
implementation of NativeJdbcExtractor. If we can help you in
any way, we will.
Thanks for the quick response, Bill! Yes, shutdown with a
delay of zero is exactly what I was thinking of. I think I'd be
sensible to add both shutdown(delay) and shutdown() to
ProxoolDataSource. Note that those methods should just shut
down the connection pool behind the given
ProxoolDataSource, not all Proxool pools.
Regarding pool initialization: Strictly speaking, the current
version isn't thread-safe, as the pool could get initialized
twice when a race condition applies. Commons DBCP's
BasicDataSource does synchronize the entire pool
lookup/creation to avoid this.
It would probably be good to add an init() method that
eagerly creates the pool, avoiding the race condition in
getConnection(). Spring supports a declarative "init-method"
too, to be invoked after bean property population, so an init()
method should work nicely in a Spring environment.
My main intention is to allow for easy use of
ProxoolDataSource as Spring-managed bean, just like
Commons DBCP's BasicDataSource. Many Spring users choose
such local DataSource definitions rather than JNDI
DataSources (although it's easy to plug in JNDI DataSources).
A Proxool implementation of Spring's NativeJdbcExtractor
interface would allow to retrieve the underlying native JDBC
objects without tying data access code to Proxool. As far as I
see, Proxool does support that in a nice fashion, just like
Commons DBCP (but in contrast to C3P0), so I'll provide such
an adapter for Proxool 0.9 (within the Spring 1.0.2 timeframe).
Any estimated release date for Proxool 0.9? As I indicated, I'd
like to explicitly support it in Spring, and also ship it with the
Spring distribution. As Spring 1.0.2 will be released today, the
earliest Spring release with explicit Proxool support could be
1.0.3, scheduled for early July.
Or course, people can use the ProxoolDataSource as Spring
bean as soon as Proxool 0.9 is released, with any Spring
version. Explicit support refers to a
ProxoolNativeJdbcExtractor implementation, and possibly to
usage in one of the Spring sample apps.
Sorry it's gone so quiet! We have very few outstanding tasks
for 0.9 but a bit of testing to do. Christian (who coded the
DataSource stuff) is right now floating down a French canal
drinking red wine on holiday (I'm jealous) but I believe he
is due back soon. I'm loathe to give you a predicted date
but can say that we are working away and are very keen to
release soon. It's been six months since 0.8.3 and 0.9.0 is
Perhaps we can progress some of the Spring integration in
It's not too urgent; it would just be great to have a direct
alternative to Commons DBCP's BasicDataSource (and C3P0's
ComboPooledDataSource). The DataSource interface is
central to Spring's JDBC support, so unfortunately Proxool
0.8.3 is not well-suited for integration into Spring.
The good thing about Spring being a dependency injection
container is that we won't need to do anything to make a
ProxoolDataSource in a Spring context: Simply define it, and
pass a reference to DAOs. For proper cleanup, there should
be a shutdown method (as we talked about earlier), to be
specified in a declarative fashion in the Spring bean definition.
So the only Spring integration work will be the (optional)
ProxoolNativeJdbcExtractor. This one is actually trivial to do:
getNativeConnection, getNativeStatement etc simply need to
delegate to ProxoolFacade's getDelegateConnection
respectively getDelegateStatement method. This is a couple
of minutes work - once Proxool 0.9 is available :-)
DataSource is now in 0.9.0RC1
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.