Hi,

it was my mistake, obviously when calling the init method of a servlet
there must have been a ServletContext created. So your right,
Connection-Pools and that like should be initialized in
ServletContextListener.contextInitialized() and I agree with your given
ordering.

Peter

----- Original Message -----
From: Gokul Singh <[EMAIL PROTECTED]>
Date: Thursday, November 22, 2001 5:23 pm
Subject: Re: ServletContextListener vs init()

> ----- Original Message -----
> From: "Peter Huber" <[EMAIL PROTECTED]>
>
> > > Peter Huber wrote
> > > > I think init should be called on startup of the servlet
> container.> > > So if you have very long lasting init procedures
> better use init.
> > >
> > > I fail to see the point here. How does the time taken to
> execute the
> > > initialization matter here.
> > >
> > Init is called on startup of servlet-container (afaik). Therefore
> > initializations are done before the very first call to a servlet in
> > your webapp. If your webapp depend on resources like a db-connection
> > pool then I think it's neat to have such resources at hand after
> > startup or cancel startup (if possible) if resources are not
> available.
> I thought you were saying that it is better to put the connection pool
> initialization in the init() method as compared to the context
> initialization event.
> There are some resources which generally belong to the application
> ratherthan a servlet, like a connection pool so these are better
> initializedutilizing the context events.
>
> So for a DB connection pool initialization the best means would be as
> follows in decreasing order of preferance
>
> 1. Context Initialization
> 2. init() method
> 3. initialization on the receiving the first request.
>
> Regds,
> Gokul
>
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to