title: update loggedIn status on session timed out
body: <p>When ever a user loggedIn to my application , I am saving the loginStatus as"LoggedIn" in Database for that user .(So multiple login cant take place from different computers).</p>
  
  <p>It works fine for me , But in 1 scenario i am facing issue .</p>
  
  <p>If a user just leave his pc and go away , Now he's trying to login from an other pc .
  But his loginStatus in db is still "loggedIn".So he is unable to login from other pc until and unless he go to the other pc(where he was previously loggedIn) and log himself out.</p>
  
  <p>Anyway i can handle this , Ideally if there is a way of Loggingout User Automatically from previous pc/browser  when ever he tries to attempt from some other location.</p>
  
  <p>I call this method when user clicks on LOGOUT link, which makes session invalid , and also make a call to db..
  What i want is to make a call to this method When there is an inactivity for lets say 2 minutes,Or user simply close his browser (Without LogginOut)</p>
  
  <pre><code>          public String logOut() throws Exception {
      System.out.println("inside server");
      User user = (User) session.getAttribute("user");
      logoutFromDb(user);// call to db
      session=getThreadLocalRequest().getSession(true);
      session.invalidate();
      System.out.println("invalidated");
  </code></pre>
  
  <p>Trying this </p>
  
  <pre><code>           DateTime lastAccessedTime = new DateTime(session.getLastAccessedTime());
      DateTime currentTime = new DateTime();
      Minutes diff =  Minutes.minutesBetween(currentTime, lastAccessedTime);
      if (diff.getMinutes()&gt;1){
          logOut();
  </code></pre>
  
  <p>But lastAccessedTime is having the time when the code came to this line itself last time</p>
  
  <p>this line:</p>
  
  <pre><code>         DateTime lastAccessedTime = new DateTime(session.getLastAccessedTime());
  </code></pre>
  
  <p>So it not giving the actual time when User did some thing , Instead it give me the time when this line was called..</p>