File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes a few interview questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "a few interview questions" Watch "a few interview questions" New topic
Author

a few interview questions

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi

1)What's a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization? Should I use the SingleThreadModel interface or provide explicit synchronization to make my JSP pages and servlets thread safe?

2) Is there a way I can set my servlets to do thread pooling? Can I spawn a background thread from my servlet?
3) When building web applications, what are some areas where synchronization problems arrise?
Rgrds
Harsha Huddar
Greenhorn

Joined: Oct 03, 2003
Posts: 23
1) Synchronisation is better as implementing SingleThreadModel is not fully thread safe.(Multiple threads can still access static variables)
SingleThreadModel is deprecated in Servlet2.4 spec and you are suggested to stop using this interface.
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
3)
a. Class variable
b. instance variable
c. session data
d. application data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: a few interview questions
 
Similar Threads
making instance variables thread safe...
What is a better approach for enabling thread-safe
help needed for variable scope and thread-safe
SingleThreadModel
Thread-safe servlets