aspose file tools*
The moose likes Servlets and the fly likes Synchronization in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Synchronization in servlets" Watch "Synchronization in servlets" New topic
Author

Synchronization in servlets

ch praveen
Ranch Hand

Joined: Mar 08, 2004
Posts: 67
Hello Friends,
Basically My servlet is not based on SingleThreadModel, but I want to synchronize only a particular portion of it [reading and writing data to a ServletContext Attribue]. Please post your suggestions.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
Synchronization in servlets is the same as synchronization in any other Java environment. However, I don't think that simple adding or removing and object as a ServletContext attribute would require synchronization. Of course if multiple requests could modify the object, thats another story.
Browsing around in the source for the Tomcat implementation of ServletContext, I found:

so it looks like the implementation is already taking care of synchronization.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronization in servlets
 
Similar Threads
Synchronizing getServletContext
Synchronizing on the getServletContext() object
Question involving servlet output and synchronization
Synchronizing ServletContext
how to synchronize service() in servlets with out using singlethreadmodal interface