Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

thread safety ?  RSS feed

 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a context attribute which is set only in one servlet and accessed in many jsps.
how do i make this attribute thread safe.



i am also looking for some multi-threading tutorial for servlet and jsp
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion would be to either synchronize on ServletContext or synchronize on the ArrayList stored in the Context and then make changes to the ArrayList.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!