java Quartz 内存泄漏

我用定时器启动应用的时候发现内存泄漏,具体报错如下:

十月 30, 2015 2:30:12 下午 org.apache.catalina.startup.HostConfig undeploy
信息: Undeploying context [/ChinaMoney Maven Webapp]
十月 30, 2015 2:30:15 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/ChinaMoney Maven Webapp] registered the JDBC driver [net.sourceforge.jtds.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
十月 30, 2015 2:30:15 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/ChinaMoney Maven Webapp] appears to have started a thread named [startQuertz_Worker-1] but has failed to stop it. This is very likely to create a memory leak.
十月 30, 2015 2:30:15 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/ChinaMoney Maven Webapp] appears to have started a thread named [startQuertz_Worker-2] but has failed to stop it. This is very likely to create a memory leak.
...

定时器定义如下:

<!-- 定义触发时间 --> <bean id="doTimeSync" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail"> <ref bean="jobtaskSync" /> </property> <property name="cronExpression"> <value>30 38 09 * * ?</value> </property> </bean> <!-- 总管理类 如果将lazy-init=false那么容器启动就会执行调度程序 --> <bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="doTimeSync" /> </list> </property> <property name="quartzProperties"> <props> <prop key="org.quartz.scheduler.instanceName">buy_it_now</prop> <prop key="org.quartz.threadPool.threadCount">2</prop> <prop key="org.quartz.plugin.shutdownhook.class">org.quartz.plugins.management.ShutdownHookPlugin</prop> <prop key="org.quartz.plugin.shutdownhook.cleanShutdown">true</prop> <prop key="org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread">true</prop> </props> </property> </bean>

请各位大神看看问题出在哪里了~跪谢!!!

public void contextDestroyedServletContextEvent sce { // 卸载JDBC驱动 Enumeration<Driver> drivers = DriverManager.getDrivers; whiledrivers.hasMoreElements{ try { Driver driver = drivers.nextElement; DriverManager.deregisterDriverdriver; } catch SQLException e { e.printStackTrace; } } // 然后我相信你还需要停止Quartz的线程,你自己看下文档怎么停止。 } 

发表评论

电子邮件地址不会被公开。 必填项已用*标注