• 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

What about the following Q. in SCWCDWhiz?

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about the following Q. in SCWCDWhiz?

Q. Which of the following JSP directives can be used to make the service() method implementation of a JSP threadsafe?

a. <%@ page isThreadSafe="false" %>
b. <%@ page isThreadSafe="true" %>
c. <%@ page isSingleThread = "true" %>
d. <%@ page isSingleThread = "false" %>
I think b. is correct. But they said a. is correct and their explanation is as follows:
"A is the correct choice. By default, the service() method of the JSP page implementation class that services the client request is multithreaded. Thus, it is the responsibility of the JSP page author to ensure that access to shared state is effectively synchronized. There are a couple of different ways to ensure that the service methods are thread-safe. The easy approach is to include the JSP page directive:
<%@ page isThreadSafe="false" %>
This causes the JSP page implementation class to implement the SingleThreadModel interface, resulting in the synchronization of the service method, and having multiple instances of the servlet to be loaded in memory. "
Please someonr make me clear...
[ August 09, 2002: Message edited by: Nazmul Huda Sarkar ]
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Both the explanation and answer are right. Declaring "isThreadSafe = false" means that the developer has not taken any action to make it threadsafe and so SingleThreadModel is implemented
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, "set it to True" is to tell the container that "OK, I have make sure that this jsp page is thread-safe, you can call multiple threads on this instance".
 
Nazmul Huda Sarkar
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm...that mean I was wrong
 
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic