Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instances of compnents within application

 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • 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??
 
Moorthi Ramasamy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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 ]
 
Sheethal Shenoy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic