[ofbiz-framework] branch release18.12 updated: Fixed: Crashed Scheduled jobs are not getting rescheduled with temporal expression (OFBIZ-11340)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch release18.12 updated: Fixed: Crashed Scheduled jobs are not getting rescheduled with temporal expression (OFBIZ-11340)

nmalin
This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release18.12 by this push:
     new d0e2ebb  Fixed: Crashed Scheduled jobs are not getting rescheduled with temporal expression (OFBIZ-11340)
d0e2ebb is described below

commit d0e2ebbb9889f64be47709ee22101a6c9fe02bc5
Author: Nicolas Malin <[hidden email]>
AuthorDate: Thu Feb 6 17:02:12 2020 +0100

    Fixed: Crashed Scheduled jobs are not getting rescheduled with temporal expression
    (OFBIZ-11340)
   
    When a OFBiz server are stopped or crashed with job on queued state,
    at the start, they are restarted but without information on tempExprId and recurrenceInfoId
   
    This causes a break for recurrence jobs to their planning
   
    Thanks to Mohammed Rehan Khan for this issue and Scott Gray for the review.
---
 .../main/java/org/apache/ofbiz/service/job/JobManager.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
index f757a26..93c189b 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
@@ -325,9 +325,16 @@ public final class JobManager {
                     newJob.set("parentJobId", pJobId);
                     newJob.set("startDateTime", null);
                     newJob.set("runByInstanceId", null);
-                    //don't set a recurrent schedule on the new job, run it just one time
-                    newJob.set("tempExprId", null);
-                    newJob.set("recurrenceInfoId", null);
+
+                    // if Queued Job is crashed then its corresponding new Job should have TempExprId and recurrenceInfoId to continue further scheduling.
+                    if ("SERVICE_QUEUED".equals(job.getString("statusId"))) {
+                        newJob.set("tempExprId", job.getString("tempExprId"));
+                        newJob.set("recurrenceInfoId", job.getString("recurrenceInfoId"));
+                    } else {
+                        //don't set a recurrent schedule on the new job, run it just one time
+                        newJob.set("tempExprId", null);
+                        newJob.set("recurrenceInfoId", null);
+                    }
                     delegator.createSetNextSeqId(newJob);
                     // set the cancel time on the old job to the same as the re-schedule time
                     job.set("statusId", "SERVICE_CRASHED");