• Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronizing ServletContext  RSS feed

 
Rajnarayan Deenadayalan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to Synchronize shared data in Servlets
Since ServletContext Variables are shared by multiple servlets in WebApplication.please provide a sample code how to use synchronize the servletcontext variables
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If one servlet in a context needs synchronized access to one of the objects "in" the context, just synchronize on that object. Use the techniques for any multi-threaded program. There is nothing magic about where it is stored.
Bill
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!