项目里有个bug问题,是有关ThreadLocal的: 我有个HibernateUtil类,里面做了个静态的ThreadLocal,存放的是一个map,map内存的是有映射关系的hibernate的session连接。 
并且在事物完成之后,没有进行session的关闭操作。我是在一个过滤器中进行关闭的,调用的是closeAllSession方法: public static void closeAllSession() { 
Map <Industry, Session> map = threadLocal.get(); if (map != null) { 
for (Industry industry : Industry.values()) { 
Session sess = map.get(industry); 
if (sess != null && sess.isOpen()) { 
try { 
sess.close(); 
} finally { 
sess = null; 

map.remove(industry); 

}// end for if (!map.isEmpty()) { 
map.clear(); 

}// end if threadLocal.set(null); 

这个filter过滤的是*.do ,也就是说,得下一次在请求的时候关闭连接。 所以问题出来了: 
1、第一次请求完毕了,也就是线程运行结束了,那么这个threadLocal也应该被回收了吧?如果被回收了,那么,里面存的session呢?是不是也自动关闭连接了? 
2、这样能关闭上次请求中操作的session连接么? 
在线等啊!!谢谢了,很重要的问题啊