db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John McNally <jmcna...@collab.net>
Subject Re: JndiDataSourceFactory
Date Wed, 06 Oct 2004 14:45:51 GMT
The reason it is not cached is that the DataSource/JNDI concept allows 
an adminstration application to change the DataSource that is bound to a 
name and an application using that name would automatically start using 
a different pool of connections.

john mcnally

Scott Eade wrote:

> Thomas Vandahl wrote:
>
>> I was trying to use JndiDataSourceFactory in my project to keep the
>> configuration together. I found, however, that the database handling is
>> much slower that with dbcp. In the code I saw that in all other
>> DataSource-Factories the ds-object is cached. Not so in
>> JndiDataSourceFactory. Does this serve a purpose?
>>
>> Anything against this fix?
>> -8<-
>>     /** A locally cached copy of the DataSource */
>>     private DataSource ds = null;
>>
>>     /**
>>      * @see org.apache.torque.dsfactory.DataSourceFactory#getDataSource
>>      */
>>     public DataSource getDataSource() throws TorqueException
>>     {
>>         if (ds == null)
>>         {
>>         try
>>         {
>>             ds = ((DataSource) ctx.lookup(path));
>>         }
>>         catch (Exception e)
>>         {
>>             throw new TorqueException(e);
>>         }
>>         }
>>
>>         return ds;
>>     }
>> -8<-
>>
>> I could see no side effects during testing but nmuch improved
>> performance. Do I miss something?
>
>
> Seems reasonable to me.  I'll add it to the small list of items to be 
> addressed for 3.1.1-rc3.
>
> Scott
>


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


Mime
View raw message