svn commit: r525721 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java

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

svn commit: r525721 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java

jacopoc
Author: jacopoc
Date: Wed Apr  4 23:20:48 2007
New Revision: 525721

URL: http://svn.apache.org/viewvc?view=rev&rev=525721
Log:
If an async service fails, the status of its JobSandbox record is set to 'failed' even if the service will not be rescheduled.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java?view=diff&rev=525721&r1=525720&r2=525721
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java Wed Apr  4 23:20:48 2007
@@ -185,6 +185,7 @@
     protected void failed(Throwable t) throws InvalidJobException {
         super.failed(t);
 
+        GenericValue job = getJob();
         // if the job has not been re-scheduled; we need to re-schedule and run again
         if (nextRecurrence == -1) {
             if (this.canRetry()) {
@@ -193,24 +194,23 @@
                 cal.setTime(new Date());
                 cal.add(Calendar.MINUTE, ServiceConfigUtil.getFailedRetryMin());
                 long next = cal.getTimeInMillis();
-                GenericValue job = getJob();
                 try {
                     createRecurrence(job, next);
                 } catch (GenericEntityException gee) {
                     Debug.logError(gee, "ERROR: Unable to re-schedule job [" + getJobId() + "] to re-run : " + job, module);
                 }
-
-                // set the failed status
-                job.set("statusId", "SERVICE_FAILED");
-                try {
-                    job.store();
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, "Cannot update the job sandbox", module);
-                }
                 Debug.log("Persisted Job [" + getJobId() + "] Failed Re-Scheduling : " + next, module);
             } else {
                 Debug.logWarning("Persisted Job [" + getJobId() + "] Failed - Max Retry Hit; not re-scheduling", module);
             }
+        }
+        // set the failed status
+        job.set("statusId", "SERVICE_FAILED");
+        job.set("finishDateTime", UtilDateTime.nowTimestamp());
+        try {
+            job.store();
+        } catch (GenericEntityException e) {
+            Debug.logError(e, "Cannot update the job sandbox", module);
         }
     }