• 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

Q about servlet instances in containers.

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it correct to say that there must be only one instance of a servlet if that servlet does not implement SingleThreadModel interface and that there may be one or more instances of any servlet that implement SingleThreadModel???
 
Ranch Hand
Posts: 1400
  • 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 there must be only one instance of a servlet if that servlet does not implement SingleThreadModel


No . As if there is a mapping like
<servlet>
<servlet-name>First</servlet-name>
<servlet-class>com.package.Hello</servlet-class>
</servlet>
<servlet>
<servlet-name>Second</servlet-name>
<servlet-class>com.package.Hello</servlet-class>
</servlet>
Then two instances will be created for each name.This may be helpful if u want to configure multiple <init-param> for same functionality.e.g. say if com.package.Hello servlet is used for connecting to database and user want to connect to two database, then user can configure two instance for each one


there may be one or more instances of any servlet that implement SingleThreadModel???


Correct.There "may be" one or more!!!
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks! just one more question: where do I learn about these xml tags???
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I referred Manning, in case u can't ... try to google around
chk out links to scwcd deployment descriptor mentioned in this site !!
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are absolutely correct leandro unless you explicity define another two different servlet names referring to the same class. Not saying it isn't good practices, but I don't know when you would want to do this but I'm sure there is a reason. The Manning book entitled Exam Study Kit is a great resource for finding out these tags as well as a study guide.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic