Hi,
This is a servlet application. It has some HashMaps in memory, which contains key value pairs. These HashMaps are updated at every 1 hour by a thread. The servlet requests(https) will have the 'key' as query
string and to fetch value from the hashmaps. The response will have the 'value'in XML format.
For the above logic, I have 3 Java Classses
1. QueryMap.java SERVLET CLASS
2. Manager.java JAVA CLASS
3. MapMonitor.java JAVA THREAD CLASS
Manager.java
-------------
In the above code,
the method processRequest() will be called by the servlet for each and every request to take the value from the hash map for the key requested.
the method addHashMap() will be called by the thread by every 1 hour to update or to place the new hashmaps in manager class. (maps are not going to be removed in this application)
My need is, If any request is processing, this thread has to wait for the processRequest method to complete. Same way, if the addHashMap() method is progress, the processRequest method has to wait utill it completes.
This code is working fine, but I am not able to figure out is there any problem of dead locks or other issues. Please review this code and suggest me whether my approah is correct or not.
Thanks
[/CODE]