• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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: 4340
36
  • 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
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!