停止tomcat服务器9时内存泄漏(war文件grails)

xytpbqjk  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(346)

我已经使用grailswar生成了war文件,并在tomcat服务器上部署了这个war文件。我有来自grails的默认调度器和在java quartz中使用quartz的自定义调度器。属性文件在资源中定义。嗯,它工作得很好,但是当我关闭服务器时,它在关闭线程时显示出一些问题。
我有grails schedulejob,它每分钟运行一次,执行一个java类,这个java类读取数据库,并基于信息使用quartz调度新作业。石英调度器一直在调度新作业,无法关闭石英调度器grailsscheduler(触发器)->javaclass(石英调度器)。grails调度器持续运行并触发使用quartz调度器的java类,当我关闭tomcat时,quartz线程仍然处于活动状态,我无法调用quartz调度器关闭方法。我们只能在用户关闭tomcat服务器时调用quartz scheduler shutdown方法,但不知道如何关闭?
grailscode:

class ScheduleJob {     static triggers = {        simple repeatInterval: 100000 // execute job once in 1 minute     }      def execute() {                 new ScheduleIBJob().schedule()           } }

整个java代码的一部分,

public static Scheduler scheduler = null;   public static Scheduler getSchedulerJobObject() throws SchedulerException {         if (scheduler == null) {            scheduler = new StdSchedulerFactory().getScheduler();           scheduler.start();          }               return scheduler;   }
org.quartz.scheduler.instanceName=IB_Scheduler
org.quartz.scheduler.instanceId=99199
org.quartz.scheduler.rmi.export=false
org.quartz.scheduler.rmi.proxy=false
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=3
org.quartz.context.key.QuartzTopic=QuartzPorperties
org.quartz.scheduler.makeSchedulerThreadDaemon=true
org.quartz.threadPool.makeThreadsDaemons=true
org.quartz.dataSource.NAME.jndiURL=java:comp/env/jdbc/db

这是一个错误

04-Jun-2021 14:14:20.758 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
04-Jun-2021 14:14:20.777 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [288,864] milliseconds
04-Jun-2021 14:14:35.664 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
04-Jun-2021 14:14:35.665 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
04-Jun-2021 14:14:36.111 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
04-Jun-2021 14:14:36.807 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [Scheduler-2.0.0] appears to have started a thread named [IB_Scheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
04-Jun-2021 14:14:36.808 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [Scheduler-2.0.0] appears to have started a thread named [IB_Scheduler_Worker-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
04-Jun-2021 14:14:36.812 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [Scheduler-2.0.0] appears to have started a thread named [IB_Scheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
04-Jun-2021 14:14:36.814 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [Scheduler-2.0.0] appears to have started a thread named [IB_Scheduler_QuartzSchedulerThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:410)
04-Jun-2021 14:14:36.866 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
04-Jun-2021 14:14:36.873 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题