Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

What about the following Q. in SCWCDWhiz?

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Hmmm...that mean I was wrong
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic