@@ -0,0 +1,1393 @@
+package com.bjtu.zs.util.listener;%0A%0Aimport javax.servlet.ServletContextEvent;%0Aimport javax.servlet.ServletContextListener;%0A%0Aimport org.apache.log4j.Logger;%0Aimport org.springframework.web.context.WebApplicationContext;%0A%0Aimport com.mysql.jdbc.AbandonedConnectionCleanupThread;%0A%0Apublic class QuartzContextListener implements ServletContextListener %7B%0A%0A%09static Logger logger = Logger.getLogger(QuartzContextListener.class.getName());%0A%0A%09@Override%0A%09public void contextDestroyed(ServletContextEvent arg0) %7B%0A/*%09%09WebApplicationContext webApplicationContext = (WebApplicationContext) arg0.getServletContext()%0A%09%09%09%09.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);%0A%09%09org.quartz.impl.StdScheduler startQuartz = (org.quartz.impl.StdScheduler) webApplicationContext%0A%09%09%09%09.getBean(%22startQuertz%22);%0A%09%09if (startQuartz != null) %7B%0A%09%09%09startQuartz.shutdown();%0A%09%09%7D*/%0A%09%09shutdownCleanupThread();%0A%09%09try %7B%0A%09%09%09Thread.sleep(1000);%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%0A%09%7D%0A%0A%09@Override%0A%09public void contextInitialized(ServletContextEvent arg0) %7B%0A%09%09// TODO Auto-generated method stub%0A%0A%09%7D%0A%0A%09void shutdownCleanupThread() %7B%0A%09%09try %7B%0A%09%09%09AbandonedConnectionCleanupThread.shutdown();%0A%09%09%09logger.info(%22%E5%AE%88%E6%8A%A4%E7%BA%BF%E7%A8%8BAbandonedConnectionCleanupThread%E5%85%B3%E9%97%AD%E6%88%90%E5%8A%9F%EF%BC%81%22);%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09logger.warn(%22SEVERE problem cleaning up: %22 + e.getMessage());%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%7D%0A

解决内存泄漏问题，手工关闭无法关闭的守护线程