Please answer these questions before submitting your issue. Thanks!
开源不易,我们希望将精力放在完成新功能和解决有价值的问题上,为了让大家的配合更具有效率,请填写以下列出的全部问题
Which version of Elastic-Job do you using?(您使用的Elastic-Job版本为?)
2.1.5
Expected behavior (您预期的结果是)
当 SpringJobScheduler 为 Spring Bean 时,可以在容器销毁时关闭 quartz 线程。
Actual behavior (实际运行的结果是)
在 SpringJobScheduler 启动后如果 Spring 容器异常退出,开启的 quartz 线程不会关闭,并且由于其是用户线程,所以会阻止 Java 进程退出。
Steps to reproduce the behavior (可重现问题的操作步骤)
由于我们是通过注解驱动并直接配置 SpringJobScheduler 为 Spring Bean 的,所以可能会有一些区别:
注册一个 SpringJobScheduler 为 Spring Bean,并设置 init 方法为 initialize method。
在其顺序之后的 Bean 的 initialize 发生抛出了异常并引起 Spring 容器退出。
SpringJobScheduler 开启的 quartz 没有关闭,Java 进程无法退出。
目前我们是通过实现一个子类,绑定 Spring Bean 的销毁事件(实现 Closeable 或是 DisposableBean),获取 schedulerFacade 并 shutdown,我希望这个方法放到 SpringJobScheduler 中成为默认的方法。
我认为这是一个完全无害的增强,如果你们也认同这一点,我将提一个 PR 去实现这个行为,感谢。
Please provide the reproduce example codes (such as github link),otherwise we will label the issue as Invalid and close it.(为了节省复现问题的时间,请务必提供可重现的代码,否则我们会将issue直接标记为invalid并关闭)