I'm writing a Web Application based on Tomcat and Java Servlets. In my case, there are some (different) Servlet that have to access to the same file, and I need a mechanism to synchronized these accesses.
I tried with a new Servlet (with empty doGet()
and doPost()
methods) that I called 'Controller', in order to use it as a 'container' for each object I need (locks, condition variables, ...). Unfortunately, this approach is based on using the method getServlet(name)
, from ServletContext
, that is deprecated and it doesn't work in my case.
Is there any known solution to this kind of problems?