commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject RE: DBCP: Jdbc2PoolDataSource needs attention
Date Mon, 11 Nov 2002 22:55:29 GMT


On Mon, 11 Nov 2002, Roytman, Alex wrote:

> Date: Mon, 11 Nov 2002 15:32:46 -0500
> From: "Roytman, Alex" <Roytmana@peacetech.com>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: RE: DBCP: Jdbc2PoolDataSource needs attention
>
> Hi Craig,
>
> Thank you for clarification. If that is tha case I think there is one
> important thing to add to tomcat JNDI - make it tomcat context aware so
> object factory knows which context it was invoked from. It will allow to
> avoid JNDI name collisions across contexts and it has some other usages
> (like factory being able to grab config files from contexts real path
> etc). Right now I use tomcat listener to publis context as environment
> entry so it can be looked up via JNDI by other JNDI factories
>

The factory that is used for connection pools
(org.apache.commons.dbcp.BasicDataSourceFactory) uses the standard JNDI
"ObjectFactory" APIs, so it receives an instance of the Context instance
in which the new name is being created.  As long as Tomcat is actually
providing the correct instance (i.e. the one for your webapp versus other
webapps), there should not be any name clash issues.

Thus, it's not clear to me where name clashes are coming from, or what the
proposed patch would be.  Could you help me out here -- most effectively
by submitting bug reports (with a test case) against Tomcat and/or
commons-dbcp that demonstrates the problem you are having?

> Alex

Craig


>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> Sent: Monday, November 11, 2002 12:30 PM
> To: Jakarta Commons Developers List
> Subject: Re: DBCP: Jdbc2PoolDataSource needs attention
>
>
>
>
> On 10 Nov 2002, John McNally wrote:
>
> > >
> > > 5. Not sure why we need to keep a static map of all pools by datasource. J2EE
environment will call jndi environment getObjectInstance() only once to create a pool and
then the environment will keep the reference and will not call factory method on each object
lookup but return previously created instance
> > >
> >
> > Tomcat may do this, I do not know.  But I do not think a jndi service is
> > required to return the same instance to every lookup.  Is there a
> > specification that says J2EE containers will cache instances?  The jdbc
> > spec mentions use of static fields as a way to code around the fact that
> > there might be multiple instances which should be referring to the same
> > pool of connections.
> >
>
> The situation with regard to caching instances (and related concerns about
> the immutability of the instances being returned) was ambiguous in the
> J2EE 1.2 and 1.3 specs, but has been clarified in J2EE 1.4 (Proposed Final
> Draft), section 5.2:
>
>     In general, lookups of objects in the JNDI "java:" namespace
>     are required to return a new instance of the requested object
>     every time.
>
> There are some listed exceptions to this rule (primarily for things that
> are known to be immutable (such as a java.lang.String) or designed to be
> singletons (at the JVM level), but these exceptions don't apply to things
> like JDBC data sources.  Looks like we'll have to change things in Tomcat
> 5.
>
> Section 5.4 talks in more detail about the container's responsibilities
> related to resource manager connection factories in a J2EE app server
> environment.
>
> You can grab the J2EE 1.4 PFD platform spec at:
>
>   http://java.sun.com/j2ee/download.html
>
>
> > john mcnally
> >
>
> Craig
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


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


Mime
View raw message