Scheduled job not failing over when master node goes down

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()

 

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助