最近准备集群,解决session共享的问题。最后发现自定义的SessionListener sessionDestroyed方法不执行。很奇怪,然后果断启用该方案。
public class SessionListener implements HttpSessionListener, HttpSessionAttributeListener{ Logger log = LoggerFactory.getLogger(SessionListener.class); @Override public void attributeAdded(HttpSessionBindingEvent arg0) { } @Override public void attributeRemoved(HttpSessionBindingEvent arg0) { } @Override public void attributeReplaced(HttpSessionBindingEvent arg0) { } @Override public void sessionCreated(HttpSessionEvent arg0) { if(log.isDebugEnabled()) { log.debug("创建session"); } } @Override public void sessionDestroyed(HttpSessionEvent arg0) { if(log.isDebugEnabled()) { log.debug("摧毁session,id:{}",arg0.getSession().getId()); } } }
感谢万能的百度,找到解决办法:
http://blog.csdn.net/u011431312/article/details/76259394
不过还没亲自尝试