title: Locking a process in Java
body: <p>I have a Java servlet which calls another software (say S) over a TCP connection. This software S uses a network resource, and the output has to be retrived from a hyperlink(using wget).<br><br>
  Since it's the same hyperlink I need to download my result from (irrespective of the request), it results into incorrect results few requests. I basically need to lock the use of this network resource across different processes (I believe each call from the servlet is going to create a new process).<br><br>
  I tried to use ReentrantLock (but I guess it only works with threads and not accross processes).<br><br>
  Please let me know how can this be achieved.</p>
  
  <p>Thanks</p>