• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

IBM 158 question ???

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic