Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to make servlet thread safe?

Answer Posted / sanjay

to make servlet as threas safe we have three approaches
1.do not instance variables into our servlet we use only
local variables
2.by using synchronized methods
3.synchronized blocks
above three ways synchronized blocks is the best way

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What exactly are the functions of servlet?

1161


What is the directory structure of a war file?

1216


What’s the use of the servlet wrapper classes??

1159


If my browser does not support cookie, and my server sends a cookie instance what will happen?

1145


Define declaration.

1124


How is the get () method different from the post() method?

1038


Which httpsession object is used to view and manipulate information about a session?

1230


Hello, My project requirement is like I need to create a web page using MVC pattern. I hava a bean class, jsp page, servlet, service and dao. My jsp has two fields. One is dropdown list. The option values has to get populated from the database table. The other one is a text box and its value has to come from database table. As of now I have defined the fields in bean class, got the values from database using arraylists in dao class and I called this from service class. Can anyone please tell me the workflow of how the servlet will get this arraylist and populate the arraylist values as dropdown options in jsp page? Also I would like to know the role of bean class in MVC pattern? Thanks in advance!

2450


Can we use the constructor, instead of init(), to initialize servlet?

1151


How to find whether a parameter exists in the request object?

1163


What mechanisms are used by a Servlet Container to maintain session information?

1218


What is the difference between encodeRedirectUrl and encodeURL?

1169


What's the difference between authentication and authorization?

1206


Why servlet is faster than jsp?

1137


How do you design microservices?

1155