db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl <thomas.vand...@tewisoft.de>
Subject JndiDataSourceFactory
Date Tue, 05 Oct 2004 14:39:21 GMT
Hi there,

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?

Bye, Thomas Vandahl.

---------------------------------------------------------------------
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