• 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

how many instances???

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how many objects are created when same or different client send 100 requests to a servlet?
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only one instance(object) is created for one servlet and for each request for this servlet a seperate thread will be created.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
same client, 100 requests: 1 Instance (including SingleThreadedModel servlet)
Diff Client, 100 request: 100 instances (SingleThrededModel servlet)
Diff Client, 100 request: 1 instances (Normal Servlet)

HTH
 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

same client, 100 requests: 1 Instance (including SingleThreadedModel servlet)



Why not 100 instances for 100 requests?
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vishal even I have the same doubt as Pradeep.

quote:
--------------------------------------------------------------------------------
same client, 100 requests: 1 Instance (including SingleThreadedModel servlet)
--------------------------------------------------------------------------------
why not 100 instances in the case of SingleThreadModel?
 
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everytime you send a request it is a new request for the server because HTTP communication is stateless. So, it does not matter if it is a same client or different client. Every request is treated as unique and different.

If you apply singleThreadModel, the instance of that servlet is giving to only one thread (request) at a time. it is NOT creating 100 instances for 100 requests. The instance will be only one, but it will be accessed by one thread (request) at a time.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

i would like to add one thing with single thread model, it is upon vendor implementation whether it allows container to create multiple instances for serving multiple requests or to serve only one request while making others to wait requesting the same servlet .The only point here is that with standard servlet model one instance and multiple threads for serving different requests for same servlet.anyways we are not going to use single thread model.Am i right

Scjp 5.0
Prp for SCWCD5.0
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"vishal kr",
Please check your private messages.
-Ben
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ah er hum....

isnt there something called container dependent?? :?
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Even i had this doubt..now it is clear...
Can any body give me a link for resource where i can read about this.

Thanks & Regards,
Sudhakar Karnati
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can any body give me a link for resource where i can read about this.

Section 2.3.3 ("Request Handling") of the Servlet 2.4 specification.
 
Shiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic