{"record":{"id":"e35e24f143597110","repo":"quarkusio/quarkus","slug":"java-util-concurrent-executionexception-wrapped-sc","errorCode":null,"errorMessage":"java.util.concurrent.ExecutionException wrapped SchedulerException from scheduler.shutdown(true)","messagePattern":"java\\.util\\.concurrent\\.ExecutionException wrapped SchedulerException from scheduler\\.shutdown\\(true\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java","lineNumber":550,"sourceCode":"     * Need to gracefully shut down the scheduler making sure that all triggers have been\n     * released before datasource shutdown.\n     *\n     * @param event ignored\n     */\n    void destroy(@Observes(notifyObserver = Reception.IF_EXISTS) @BeforeDestroyed(ApplicationScoped.class) Object event) {\n        if (scheduler != null) {\n            try {\n                if (shutdownWaitTime.isZero()) {\n                    scheduler.shutdown(false);\n                } else {\n                    CompletableFuture.supplyAsync(new Supplier<>() {\n                        @Override\n                        public Void get() {\n                            // Note that this method does not return until all currently executing jobs have completed\n                            try {\n                                scheduler.shutdown(true);\n                            } catch (SchedulerException e) {\n                                throw new RuntimeException(e);\n                            }\n                            return null;\n                        }\n                    }).get(shutdownWaitTime.toMillis(), TimeUnit.MILLISECONDS);\n                }\n\n            } catch (Exception e) {\n                LOGGER.warnf(\"Unable to gracefully shutdown the scheduler\", e);\n            }\n        }\n    }\n\n    @PreDestroy\n    void destroy() {\n        if (scheduler != null) {\n            try {\n                if (!scheduler.isShutdown()) {\n                    scheduler.shutdown(false); // force shutdown","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java#L532-L568","documentation":"During graceful shutdown with a non-zero quarkus.quartz.shutdown-wait-time, Quarkus calls scheduler.shutdown(true) in a CompletableFuture and wraps any SchedulerException from it in a RuntimeException inside the async supplier. The outer future then fails with a TimeoutException on expiry or an ExecutionException wrapping this RuntimeException. This exception is caught by destroy() and only logged as a warning — the application still shuts down.","triggerScenarios":"Application shutdown with shutdown-wait-time > 0 while scheduler.shutdown(true) (wait for running jobs to complete) throws SchedulerException — e.g. JobStore error while waiting on JDBC store, or the shutdown interrupted by store failure.","commonSituations":"Long-running jobs exceeding shutdown-wait-time (TimeoutException path); JDBC store failing during shutdown; DB already torn down before the scheduler's graceful shutdown runs.","solutions":["Increase quarkus.quartz.shutdown-wait-time to exceed the longest job duration","Make jobs interruptible/cooperative so shutdown(true) completes quickly","Ensure the datasource remains available until scheduler shutdown completes (Quarkus handles ordering, but verify custom ordering)","Treat this log warning as non-fatal; set shutdown-wait-time to 0 (PT0S) to skip graceful wait and force shutdown"],"exampleFix":"// before (application.properties)\nquarkus.quartz.shutdown-wait-time=5S\n// after\nquarkus.quartz.shutdown-wait-time=60S  # longer than the slowest job","handlingStrategy":"try-catch","validationCode":"// ensure jobs finish before shutdown-wait-time expires\nDuration longestJob = measureLongestJob();\nassert shutdownWaitTime.compareTo(longestJob) > 0;","typeGuard":null,"tryCatchPattern":"// Quarkus logs this as a warning in destroy(); no user catch needed.\n// For custom shutdown code:\ntry {\n    future.get(waitMillis, TimeUnit.MILLISECONDS);\n} catch (TimeoutException e) {\n    LOGGER.warn(\"Graceful quartz shutdown timed out; jobs may still be running\");\n} catch (ExecutionException e) {\n    LOGGER.warnf(e.getCause(), \"Quartz graceful shutdown failed\");\n}","preventionTips":["Set quarkus.quartz.shutdown-wait-time above your longest job duration","Keep jobs interruptible so shutdown(true) returns promptly","Treat the log warning as informational — shutdown proceeds anyway","Use store-type=memory to avoid store failures during shutdown"],"tags":["quartz","scheduler","shutdown","graceful-shutdown"],"backgroundTag":"graceful-shutdown-timeout","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}