• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IBM 158 question ???

 
xiaolin yu
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer of the question below is d. Could anybody tell me why?
Thanks in advance.
A Servlet must perform 3 operations that are independent of one another. They are time consuming with each operation consuming about 10
msec of CPU. The Servlet's response depends on the completion of all three operations. The developer decides to perform each operation
on a separate worker thread to run them concurrently. Which of the following describe important parts of this implementation?

a) The Servlet should implement MultiThreadModel.
b) The Servlet should implement SingleThreadModel.
c) Access to the HttpSession must be synchronized.
d) The worker threads must not write to the ServletOutputStream.
e) The worker threads must not read from the ServletInputStream.
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
d) would mean that each concurrent thread would write to the ServletOutputStream. I haven't tried, but I am quite sure that this does not work. 3 concurrent threads for one outputstream. Nope.
Some relationship to more common phenomen that you can't use sendRedirect if ServletOutputStream is commited.
a) does not exist.
b) has nothing to do with question. SingleThreadModel is about creating different ServletInstances per request. This question is about parallel use of ServletOutputStream in one request.
c) Session not mentioned in questioned.
e) why not? see no problem.
I would call this a tricky question.
[ March 05, 2003: Message edited by: Axel Janssen ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic