| Author |
Achieving thread safe without synchronize
|
Anand Natraj
Ranch Hand
Joined: May 17, 2004
Posts: 53
|
|
Hi frendz, Can some one just tell me how to have servlets thread safe without using synchornizing a block in my code.
|
 |
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
|
Create new objects (if it is possible) to avoid synchonization.
|
Groovy
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Don't use instance variables. Declare all of your variables inside your doGet and doPost methods. This will take you a long way. If you have multiple requests accessing context or session scope objects, you may need to do some more thinking. There are no simple rules in these cases.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: Achieving thread safe without synchronize
|
|
|