cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: [jira] [Commented] (CAY-1864) Process threads waiting for an available DB connection in the order they came in
Date Fri, 20 Dec 2013 15:48:37 GMT
On Fri, Dec 20, 2013 at 12:23 AM, Andrus Adamchik <andrus@objectstyle.org>wrote:

> (taking this to dev)
>
> On Dec 20, 2013, at 1:46 AM, John Huss (JIRA) <jira@apache.org> wrote:
>
> > John Huss commented on CAY-1864:
> > --------------------------------
> >
> > I've got tomcat-jdbc in my project now, so I'm going to try that rather
> than continue improving PoolManager. One issue I had with integrating
> tomcat-jdbc is that if you configure your data source using cayenne's
> properties (like cayenne.jdbc.driver) then it switches your
> DataSourceFactory to PropertyDataSourceFactory even if you have entered a
> custom factory in your cayenne.xml file.  I'd suggest that cayenne should
> only override the factory if it is the default value -
> XMLPoolingDataSourceFactory.
> >
> > As a workaround I renamed my properties (which I am still using).  But
> it would be nicer to have the same property names and be able to switch
> connection pool implementations merely by changing the DataSourceFactory.
>
> This is by design. The actual DataSourceFactory, as defined in the
> ServerModule is DelegatingDataSourceFactory:
>
>
> binder.bind(DataSourceFactory.class).to(DelegatingDataSourceFactory.class);
>
> The point of which is that the app (or even a deployer) should have an
> easy way to override a factory name specified in XML.
>
> cayenne.jdbc.* properties are of course intended for
> DelegatingDataSourceFactory/PropertyDataSourceFactory. Are you using these
> properties for something else?
>

I'd like to use the same property names to configure my own
DataSourceFactory, which is basically identical to
PropertyDataSourceFactory, but uses the tomcat-jdbc connection pooling.
 The use of properties to configure the data source is somewhat orthogonal
to the choice connection pool implementation.

Since DelegatingDataSourceFactory is only meant to switch between the
Property or XML factory then it should only do that, so I'd like to add
this:

    protected boolean shouldConfigureDataSourceFromProperties(
            DataNodeDescriptor nodeDescriptor) {

if
(!(XMLPoolingDataSourceFactory.class.getName().equals(nodeDescriptor.getDataSourceFactoryType())
||
  PropertyDataSourceFactory
 .class.getName().equals(nodeDescriptor.getDataSourceFactoryType()))) {
return false;
}
...
}


>
> Andrus
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message