• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

instances of compnents within application

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I have the following configuration within my deployment descriptor:
and a ClassX that implements javax.servlet.ServletContextListener and extends javax.servlet.http.HttpServlet
.
.
.
<listener>
<listener-class>path.of.my.ClassX</listener-class>
</listener>
<servlet>
<servlet-name>nameofMyServlet</servlet-name>
<servlet-class>path.of.my.ClassX</servlet-class>
</servlet>
.
.
.
is it correct to say that I may have 2 instances of my path.of.my.ClassX??
and that I can have no more than 2 instances of my path.of.my.ClassX??
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by leandro oliveira:
is it correct to say that I may have 2 instances of my path.of.my.ClassX??and that I can have no more than 2 instances of my path.of.my.ClassX??


Yes.
First instance (listner) will be available as soon as the servlet context is loaded in your server.
Second instance (servlet) availability depend on the <load-on-startup>
if (load-on-startup >= 0) ==> 2nd instance is available as soon on context is loaded, but after first instance is created.
if (load-on-startup < 0 )==> Availability of 2nd instance is container depended. (mostly request time)

You can have any number instances for your path.of.my.ClassX by defining servlet-class with unique servlet-name in deployment descriptor.
Thanks,
Moorthi
[ February 16, 2004: Message edited by: Moorthi Ramasamy ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have
<servlet>
<servlet-name>notify</servlet-name>
<servlet-class>org.diabetes.phd.PHDNotify</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>notify</servlet-name>
<url-pattern>notify.phd</url-pattern>
</servlet-mapping>

in my web.xml in weblogic 7.0 .But on startup i get 2 instances on the servlet.Irrespective of <load-on-startup> is 0 or 1 i get 2 instances on the servlet.Could anyone explain this behaviour.I would appreciate any help
Thanks
Sheets
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic