GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 731 of 937    Print  
how we can makes a servlet thread safe?

  
Total Answers and Comments: 3 Last Update: January 04, 2007     Asked by: ranjansukrit 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 08, 2006 22:30:14   
delindia fathima        

RE: how we can makes a servlet thread safe?

We can make our servlets thread safe by surrounding the block of code with the synchronized blocks.While a particular synchronized block is executing no other section of code that are synchronized to the same block can execute.

But a more complex servlet need to synchronize its entire method limiting the servlet to one request at a time.This can be done by implementing SingleThreadModel interface. It has no methods.It tells the server to create a pool of instance instead of single instance of the servlet.

Delindia fathima


 
Is this answer useful? Yes | No
December 28, 2006 01:08:06   
ambar        

RE: how we can makes a servlet thread safe?
by using syn
 
Is this answer useful? Yes | No
January 04, 2007 01:04:29   
srikiran_bab@yahoo.com        

RE: how we can makes a servlet thread safe?
By implementing SingleThreadModel interface in javax.servlet. package to your servlet you can make the servlet single threaded and another thing is it does'nt contains any methods the web server will takes care about your servlet
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape