title: Storing a list of currently edited files
body: <p>I must program a webapp that let's a user create and modify files.</p>
  
  <p>Those files will be stored on the server. There are mainly two pages in this app : the first one lists the files the user is allowed to see. The user click on one of the item of this list : this let him go to the second page, where he can edit the file.</p>
  
  <p>My problem is simple : I want to make sure that you cannot see, in the first page (list of every files) files that are currently being modified by another user (in the second page). The application is in Java EE using Struts 1 (I didn't decide about that).</p>
  
  <p>I've considered using a static List, for instance, that let me register every files that are currently opened ; I would put a file in the list when a user click and edit the file. In an ideal world, when the user save his work or goes back to the list, I would then remove the file from the list. However:</p>
  
  <ol>
  <li>This is not thread-safe</li>
  <li>What if a user just closed the browser?</li>
  </ol>
  
  <p>What way would you proceed to solve this problem?</p>