Synchronization - access to hashmap-Servlets& threads
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   anurad_ganesan
Posted On:   Monday, April 26, 2004 09:48 PM

Iam developing a code.It is a web application in which iam using a hash map.Access to hash map are in two ways:



1. servlet writes data in to the hashmap.
2. thread reads data from the hashmap and deletes the same from the hash map.
3.I have written a seperate method to read the data from hash map which is called by the thread.



My question is
1.is synchronization needed for writing the data in case the servlet is accessed simultaneously?
2.How to synchronize the access to the hashmap by the threads ?

Re: Synchronization - access to hashmap-Servlets& threads

Posted By:   tech_tech  
Posted On:   Wednesday, April 28, 2004 10:47 AM

there is a method attribute called synchronised which u may want to read about. i m not giving out anything for a lazy person who depends on jguru all the time for free advice.

u seem to be messing around with servlets and threads - which makes me feel u may be messing around with some data corruption across sessions / threads. all the best to your end users
About | Sitemap | Contact