• 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 servlet process the different client request???

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

If multiple client access the same servelt, then it creates thread.
it means that only when the first thread completes then only it call the second thread.

is it correct???

if it is correct , then the process will be slow......

i am confused with this.........

please clear my doubt..

how servelt process the request???


thanks in advance
Gopal
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

it means that only when the first thread completes then only it call the second thread.

is it correct???



No, not correct. The whole point of threads is that they execute simultaneously.
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

But by default, the servlet is THREAD SAFE
<%@ page isthreadsafe="true">

please clarify

Gopal
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a JSP directive and has nothing whatsoever to do with servlets that are not JSPs.

And within JSPs, that directive does not make a JSP thread-safe. It is a directive that tells the container that you have written the JSP in a thread-safe manner.
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks bear,

please check my understanding is correct...

if threadsafe = true , means the container creates a thread for the request and maintain a single instance of servlet,

whereas if threadsafe= false, the container creates multiple instances of servlet class instead of creating a thread.

am i right??
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, not right.

And again, this has nothing to do with general servlets. Only JSPs.

If you set threadsafe=false, the container will serialize access to the JSP. Not a good idea as it would likely result in performance degradation.
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks bear, i got it..

but last doubt..

when the container creates multiple servelt instance???
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Gopal
Container never maintains multiple servet instances. I creates only one instance of the servlet, when the first request is executed or u have selected load on start up option. Thereafter only each thread gets executed per request.
There was a interface before called as SingleThreadModel which is deprecated now. Some documentation says that when u implement this model, you are guaranteed that no two threads will execute concurrently in the servlet's service method or container may create multiple instances of the servlet where each request is assigned one. There was a whole lot of confusion with this interface as it was a marker interface.
Today u must remember one point, there is one and only one instance created for servlet instance.

Let me know if i am wrong or making any sense 2 u.

Regards
Makarand Parab
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks for your reply.

Now i am clear with your replies.


thanks
Gopal
 
A wop bop a lu bop a womp bam boom! Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic