On Tue, 18 May 1999, David Mossakowski wrote:

> No servlet engine I know of creates two instances of a servlet the way you
> describe it.
There seem to be some... at least those distributed (dispatching
requests across multiple JVMs) pretend are capable of that.

>  The init() method is "guaranteed" (from Servlet API) to be called
> only once at start up.
Once when fire the same instance, yes - I was not arguing about the
"common" case when engines create only one instance of a servlet,
I asked if there is a way to prevent them not to create the second..

> You can store variables that will be common to all threads by putting them in
> context. (context.setAttribute())
But then any other servlet (and those written at evil.programmers.org)
will be able to grab that public data. (let say we talk about a database
pool wich gives access to company's accounting tables)

>
> Check the servlet API.
checked, its in version 2.1 only

Cezar.

> Cezar Totth wrote:
>
> > On Mon, 17 May 1999, jon * wrote:
> >
> > > > I would like a "SingleInstanceServlet" interface,
> > > > in order to force servlet engine NOT to create multiple
> > > > instances of a certain servlet.
> > > >
> > > > This would guarantee that all concurent requests share the same
> > > > local variables.
> > >
> > > Why in the world would you want to take the multi-user nature of serving
> > > dynamic websites and focus that into a single threaded system? What exactly
> > > would you gain by doing that?
> > >
> > Hi, not single-threaded was what I meant.. I said single instance -
> > multithreaded, of course (except for the case it implements
> > SingleThreadedModel too - when it becomes single-threaded).
> >
> > I suppose some servlet engines create (are not restricted from creating)
> > multiple instances for the same servlet, for distributed-engines
> > or STM model optimisations.
> >
> > Sometimes I dont want that to happen, like when I want to
> > keep some entity-data (global object, shared betwen all sessions)
> > in local variable, and need to be sure that these variables are unique,
> > not (re)created at each servlet.init() call.
> >
> > Cezar
> >
> > ___________________________________________________________________________
> > 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
>
> --
> David Mossakowski        [EMAIL PROTECTED]
> http://www.dwdog.com/styk      212.310.7275
>
> "I don't sit idly by, I'm planning a big surprise"
> F         U         G         A        Z        I
>
> ___________________________________________________________________________
> 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
>

___________________________________________________________________________
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