• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

SingleThreadModel Mock Question

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can you give a little more explanation?
Thanks,
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic