Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

JWebplus : Question ID :1000056254950

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q. A servlet implements SingleThreadModel interface. The servlet container may run multiple threads on its methods.

True or False ?
I answered False....but in JWeb..it is True ? Why ?
 
Enthuware Software Support
Posts: 4427
41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The correct answer is indeed given as false. The explanation is also given:


No, the container cannot let multiple threads execute the methods of the same instance at the same time. This is guaranteed by the specification. To support multiple user requests, the container may create multiple instances of this servlet.


I don't see any correct history for this question either.
HTH,
Paul.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can run multiple threads, however not in the same time..
its a trap question, i dont want to get this in the exam!!
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a doubt!
if a servlet implements SingleThreadModel, all your methods are to one thread, not only the service method.
its right??
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
How about create threads in service() method ?
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Nazmul,
Hi how are you? I remember you were studying for SCPJ2 around same time as me Jan this year. Im just bought Webplus to start prep for exam.
Refer to your question - SingleThreadedModel
my references state:
when your servlet implements this interface - the server queues up all the request threads passing them one at a time to the servlet instance.
So the answer is true from this perspective.
Regards
Stephen
SCPJ2
 
Nazmul Huda Sarkar
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Stephen
Yes..I do remember you. How are you ? I'm going to sit for SCWCD next 28/30th Sept. Still I have few problems
You are right. Servlet container will pass multiple request one by one. But there is only one instance of the servlet..right? May be multiple instance to serve multiple request. But no multiple thread of same servlet instance. So the answer should be false.
And "can run multiple threads, however not in the same time..
" ...if so...then what is the advantage of thread
Anyway...hope not to face such tricky question
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic