tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
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 <aspa@kronodoc.fi>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> Cc: mini78@lycos.com
> 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
<http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html>
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
Tomcat.

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:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message