JobHandler.ktAbstractJob. Handles job registration, queue strategy evaluation, coroutine-based execution, timeout enforcement, cleanup of terminated jobs, and health-check monitoring via email alerts. Implements ShutdownListener to cancel running jobs gracefully on application shutdown.ShutdownService in @PostConstructList<AbstractJob> as the job registry| Method | Description |
|---|---|
addJob(job) | Registers job, spawns a coroutine via runBlocking { launch { ... } } that waits for queue clearance then calls job.start() |
tidyUp() | Called every minute by JobHandlerScheduler; cancels timed-out jobs, removes old terminated jobs |
cancelJob(job) | Cancels job if user has write access; calls job.cancel() |
shutdown() | Cancels and joins all running jobs on application shutdown |
The addJob method spawns a coroutine that:
other.isBlocking(job)checkStatus() — verifies tidyUp() was called within last 5 minutesreportErrorMail(message) — sends email to support address via SendMail using Groovy template mail/feedback.txtWhen launching the job coroutine, the following contexts are propagated:
ThreadLocalUserContext.userContextAsContextElement (preserves logged-in user)ThreadLocalUserContext.localeAsContextElement (preserves locale for i18n)MDCContext() (preserves SLF4J MDC for logging)KEEP_TERMINATED_JOBS_INTERVALL_MS = 1 hour (Constants.MILLIS_PER_HOUR)868d6abb7 2025 -> 2026 00ec94e68 New version of fr-opensagres-xdocreport-poi-xwpf-converter-pdf, DataTransferBridge, ThreadLocalUserContext for coroutines. 63081666f Source file headers: 2024-> 2025. 5f9fbbbd3 Fix typos in projectforge-business directory f8961fd66 Shutdown handling improved: ShutdownService shuts down some services before database. 67805f2fc ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser 77bade6df javax.* -> jakarta.* b6092df09 Copyright 2023 -> 2024 a060d94b0 JobHandler was not scheduled. Fixed. bdcc7ed73 Report failure of Spring scheduler as mail (to be tested). ab45d51fa Copyright 2001-2022 -> 2001-2023. 163492453 WIP: Jobs and Bank account records. 9f6ae7a0f WIP: Jobs. 232a91c5a BaseUserGroupRightUtils implemented. WIP BankingPlugin and jobs-handling. 7bc51ed17 WIP: Jobs. 38bec971a ThreadLocal -> Kotlin f99714d0a Wrong log import fixed. fcc4c67f6 WIP: Jobmonitor. d93f61491 WIP: Banking plugin (and new import module). cd69cc40f WIP: Banking plugin (and new import module). 67eed70e4 WIP: Banking plugin (and new import module). JobHandler/monitor started.