title: Why session is not null after session.invalidate() in JAVA?
body: <p>I am facing very strange problem while developing JavaEE WEB Application.</p>
  
  <p>Even after invalidating the <code>HttpSession</code> using <code>session.invalidate();</code>, I am not getting session <code>null</code>. There is a case where I have one statement in execution like below after invalidating session.</p>
  
  <pre><code>if (null != session &amp;&amp; null != session.getAttribute("loginToken")){
     //do something
  }
  </code></pre>
  
  <p>I am not getting session null here so second condition will try to execute. And hence session is not null, so I am getting <code>IllegalStateException</code> - <code>session is already invalidated</code>. But why session is not null after invalidating it?? :(</p>