非托管线程Spring Quartz Websphere Hibernate [英] Unmanaged Threads Spring Quartz Websphere Hibernate
问题描述
我做了一些阅读,并从IBM那里找到一篇技术文章,声明Quartz和Spring的使用会导致这种情况。他们提出了使用CommnonJ来解决这个问题的建议。
我已经做了一些进一步的研究,并且迄今为止我看到的唯一例子都涉及旧的JobStore计划不在数据库中。
所以,我想知道是否有人有解决此问题的例子。
感谢
我们有一个适用于此的解决方案(实际上有两个解决方案)。 b $ b
1)修改石英源代码以使用主调度程序线程的WorkManager守护进程线程。它有效,但需要更改夸脱。我们没有使用这个,因为我们不想保留黑客版本的石英。 (这提醒了我,我将把它提交给项目,但完全忘了)2)创建一个WorkManagerThreadPool作为石英线程池使用。实现石英ThreadPool的接口,以便在quartz中触发的每个任务都包装在一个commonj工作对象中,然后将在WorkManager中进行调度。关键是WorkManagerThreadPool中的WorkManager必须在启动调度程序之前从Java EE线程(例如servlet初始化)初始化。然后,WorkManagerThreadPool必须创建一个守护程序线程,该线程将通过创建和安排新的工作对象来处理所有计划的任务。这样,调度器(在它自己的线程上)将任务传递给一个托管线程(Work守护进程)。
不简单,不幸的是我没有代码随时可以包括。
It appears that our implementation of using Quartz - JDBCJobStore along with Spring, Hibernate and Websphere is throwing unmanaged threads.
I have done some reading and found a tech article from IBM stating that the usage of Quartz with Spring will cause that. They make the suggestion of using CommnonJ to address this issue.
I have done some further research and the only examples I have seen so far all deal with the plan old JobStore that is not in a database.
So, I was wondering if anyone has an example of the solution for this issue.
Thanks
We have a working solution for this (two actually).
1) Alter the quartz source code to use a WorkManager daemon thread for the main scheduler thread. It works, but requires changing quarts. We didn't use this though since we didn't want maintain a hacked version of quartz. (That reminds me, I was going to submit this to the project but completely forgot)
2) Create a WorkManagerThreadPool to be used as the quartz threadpool. Implement the interface for the quartz ThreadPool, so that each task that is triggered within quartz is wrapped in a commonj Work object that will then be scheduled in the WorkManager. The key is that the WorkManager in the WorkManagerThreadPool has to be initialized before the scheduler is started, from a Java EE thread (such as servlet initialization). The WorkManagerThreadPool must then create a daemon thread which will handle all the scheduled tasks by creating and scheduling the new Work objects. This way, the scheduler (on its own thread) is passing the tasks to a managed thread (the Work daemon).
Not simple, and unfortunately I do not have code readily available to include.
这篇关于非托管线程Spring Quartz Websphere Hibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!