title: Check my code, I‘m using ThreadLocal to manage HttpSession
body: <p>I'm use ThreadLocal to manage HttpSession. code as below:</p>
  
  <pre><code>public class HttpSessionLocal {
  
      private static ThreadLocal&lt;HttpSession&gt; threadLocal = new ThreadLocal&lt;HttpSession&gt;();
  
      public static HttpSession getSession(HttpServletRequest request) {
          HttpSession session = threadLocal.get();
          if (session == null) {
              threadLocal.set(request.getSession());
          }
          return threadLocal.get();
      }
  
      public static void setSession(HttpSession session) {
          threadLocal.set(session);
      }
  
  }
  
  
  public class SessionListener implements HttpSessionListener {
  
      public void sessionCreated(HttpSessionEvent httpSessionEvent) {
      }
  
      public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
          HttpSessionLocal.setSession(null);
      }
  }
  </code></pre>
  
  <p><strong>Can we do this? If not, how can we improve it? Thanks!</strong></p>