Legacy Knowledge Base
Published Sep. 10, 2025

Scheduled job not failing over when master node goes down

Written By

Dávid Hegedüs

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • You might encounter an issue with your custom scheduled jobs where they are not getting planned if the master node goes down and the new master is elected

Environment

  • Liferay DXP 7.0+

Resolution

  • Make sure that you use unregister() instead of unschedule() in the deactivate() method

Additional Information

  • If a scheduled job calls unschedule() during its component deactivation, and that deactivation happens as part of the ModuleServiceLifecycle unregistration, that scheduled job will be unscheduled across the cluster. At that stage of the shutdown sequence, Liferay has not setup any flags to indicate that Liferay's servlet context has been destroyed (because technically, the servlet context is not destroyed yet since servlets are still in the process of being destroyed).
  • Looking at existing Blade samples, we do not unschedule() during component deactivation, just unregister()

 

Did this article resolve your issue ?

Legacy Knowledge Base