Hello Primoz,
Actually, the code you wrote should work. What JSP engine are you using?
Dani's code might do the trick. If that still doesn't work, you might want
to try using a Singleton (see the book Design Patterns by Gamma et al.) to
make sure that only one instance of the class is ever created.
regards,
Manne
-----Original Message-----
From: Clemente Dani [mailto:[EMAIL PROTECTED]]
Sent: 10 November 2000 08:24
To: [EMAIL PROTECTED]
Subject: Re: bean initialization lock
Hi, it should be working, shouldn't it?. Try putting your init()
reference into you bean constructor method.
Bye, Dani
----- Mensaje Original -----
De: Primo=BE Hrvatin <[EMAIL PROTECTED]>
Fecha: Jueves, Noviembre 9, 2000 3:18 pm
Asunto: bean initialization lock
> Hi!
>
> Is it possible to prevent other JSP pages from initializing multiple
> instances of an application scoped bean? I'm using gnujsp 1.0.1 on
> apache1.3.14/Jserv 1.1.2.
>
> I have this code in various JSP pages, which I want to be executed
> onlyonce in whichever page that is loaded first:
>
> <jsp:useBean id="abc" scope="application" class="....">
> <%
> abc.init(application);
> %>
> </jsp:useBean>
>
> init() method has synchronized access, so it should be impossible for
> multiple bean instances to get initialized. The init() method
> starts a
> thread which writes to the servlet context log. Yet, I get
> multiple thread
> instances if the JspServlet is initialized with multiple client
> requests,i.e. heavy load.
>
> Help very much appreciated!
>
> Primoz
>
>
========================================================================
===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
________________________________________________________________
Consigue tu cuenta gratuita de acceso a internet y de correo en
http://www.navegalia.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets