Win a copy of AWS Security this week in the Cloud/Virtualization 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

SingleThreadModel Mock Question

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose that Myservlet implements SingleThreadModel.
and there are
Local variables
Instance variables
Class variables
Request attributes
Session attributes
Context attributes
Which among these variables would be thread safe
Select any one
A Local and Request Variables
B Local,Instance and request variables
C Local,Instance,request,class variables
D None of these
I donot know the correct answer but I think it shud be A
Can anyone correct me if I am wrong?
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it should be B
When you gonna take the exam, Gaurav ?
 
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you give a little more explanation?
Thanks,
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Local variables will be ridded of by the time the method returns so there's no worrying about other threads.
From the servlet specification (regarding static variables):
"The SingleThreadModel interface does not prevent synchronization problems that results from servlets accessing shared resources such as static class variables or classes outside the scope of the servlet".
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic