commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roytman, Alex" <Roytm...@peacetech.com>
Subject RE: DBCP: Jdbc2PoolDataSource needs attention
Date Mon, 11 Nov 2002 20:32:46 GMT
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

Alex

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


Mime
View raw message