• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we control no of servlet instances ?

 
Akilan IrudayaRaaja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Is it possible to specify the no of servlet instances in servletcontainer? i.e using web.xml


Thanks ,
Akilan
 
Tejas Bavishi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
See this note in the web-app_2_3.dtd :

The load-on-startup element indicates that this servlet should be
loaded (instantiated and have its init() called) on the startup
of the web application. The optional contents of
these element must be an integer indicating the order in which
the servlet should be loaded. If the value is a negative integer,
or the element is not present, the container is free to load the
servlet whenever it chooses. If the value is a positive integer
or 0, the container must load and initialize the servlet as the
application is deployed. The container must guarantee that
servlets marked with lower integers are loaded before servlets
marked with higher integers. The container may choose the order
of loading of servlets with the same load-on-start-up value.

HTH
Tejas

Originally posted by Akilan IrudayaRaaja:
Hi All,

Is it possible to specify the no of servlet instances in servletcontainer? i.e using web.xml


Thanks ,
Akilan
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tejas,load-on-startup is used to specify the preloading and loading order of servlets/JSP.

Akilan, web.xml does not provide any mechanism to specify the number of servlet instances
 
Tejas Bavishi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the correction, Siva


Originally posted by Sivasundaram Umapathy:
Tejas,load-on-startup is used to specify the preloading and loading order of servlets/JSP.

Akilan, web.xml does not provide any mechanism to specify the number of servlet instances
 
ravikant
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
There is a always one instance of servlet and multiple treads(request)
excute the service method of servlet. By default this is the behaviour.

But if you implement SingleThreadModel interface, then you configure
no of instances on server specific file. Its all managed by container.

But as per new specs of j2EE, there wouldn't be any more support
to SingleThreadModel.

regards
ravikant
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ravikant,

Can you please change your display name according to Javaranch naming policy?

Regards
Siva
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic