Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporting: How to cope with long running/hung jobs? #190

Open
flange-ipb opened this issue May 30, 2022 · 0 comments
Open

Reporting: How to cope with long running/hung jobs? #190

flange-ipb opened this issue May 30, 2022 · 0 comments

Comments

@flange-ipb
Copy link
Contributor

At the moment reporting jobs are executed by the ManagedExecutorService (MES) without any timeout, thus tasks may run forever.
Unlike other application servers' MES implementations, TomEE's MES does not have a "hung-task-threshold" config parameter.

How to detect hung tasks?
A scheduled method could check the "jobs" table for BUSY jobs with "jobdate" before some date. These jobs can be either in the MES's queue or are currently executed.

How to stop tasks?
MES does not offer any access methods to get the queue list or the current tasks in execution. The only way to manipulate tasks from outside is via the Future returned by the submit method of the MES. Futures offer a cancel() method.

Thus, a possible implementation could be to cache the submitted Futures (association with the Job via a Map<Future,Job>, hoping that TomEE's Future implementation has a proper equals()/hashCode() ...). This has to be done in a Singleton-EJB with proper synchronization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant