tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: InitialContext
Date Mon, 12 Nov 2001 06:02:46 GMT

On Sun, 11 Nov 2001, Marko Asplund wrote:

> Date: Sun, 11 Nov 2001 20:55:37 +0200 (EET)
> From: Marko Asplund <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Cc:
> Subject: Re: InitialContext
> On Fri, 9 Nov 2001, Craig R. McClanahan wrote:
> > ...
> > I assume you mean what you get when you call:
> >
> >   InitialContext context = new InitialContext();
> >
> > right?  That is a per-web-application place where the container can
> > provide services and resources (like database connection pools) to a web
> > application, which can access them in a portable manner.  The
> > InitialContext API itself is from the Java Naming and Directory Interface
> > (JNDI) APIs.
> what kind of functionality does the container provide exactly for the
> configured resources? does it just create an instance of the configured
> resource type and make it available in the configured context? i suppose
> the container doesn't implement any resource pooling?

It depends on what resource you are configuring.  See
for more details.

For the JDBC data source resource, the returned object is an instance of
javax.sql.DataSource -- i.e. a connection factory that you then call to
ask for a database connection.  The connection pool itself is provided by

For the Mail Session resource, you get a javax.mail.Session instance
itself -- essentially, the resource acts as a factory.  Your application
doesn't have to care whether or not the Session instance is shared,
because it doesn't matter in JavaMail.

For resources you define yourself (that are compatible with the "Generic
JavaBeans Resources" factory, it is totally up to your implementation
class whether you provide a factory object, or whether your resource acts
as a factory object.

> --
> 	aspa

Craig McClanahan

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message