Author: lektran
Date: Fri Jan 15 17:07:06 2010
New Revision: 899716
URL: http://svn.apache.org/viewvc?rev=899716&view=rev
Log:
Removed recurrence info checking when reloading crashed jobs, fixes OFBIZ-2974.
I can't see any reason why a crashed job would already have been rescheduled
considering that only happens when a job completes or fails.
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=899716&r1=899715&r2=899716&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Fri
Jan 15 17:07:06 2010
@@ -224,36 +224,28 @@
try {
int rescheduled = 0;
for (GenericValue job: crashed) {
- long runtime = job.getTimestamp("runTime").getTime();
- RecurrenceInfo ri = JobManager.getRecurrenceInfo(job);
- if (ri != null) {
- long next = ri.next();
- if (next <= runtime) {
- Timestamp now = UtilDateTime.nowTimestamp();
- // only re-schedule if there is no new recurrences
since last run
- Debug.log("Scheduling Job : " + job, module);
-
- String pJobId = job.getString("parentJobId");
- if (pJobId == null) {
- pJobId = job.getString("jobId");
- }
- GenericValue newJob = GenericValue.create(job);
- newJob.set("statusId", "SERVICE_PENDING");
- newJob.set("runTime", now);
- newJob.set("previousJobId",
job.getString("jobId"));
- newJob.set("parentJobId", pJobId);
- newJob.set("startDateTime", null);
- newJob.set("runByInstanceId", 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");
- job.set("cancelDateTime", now);
- delegator.store(job);
+ Timestamp now = UtilDateTime.nowTimestamp();
+ Debug.log("Scheduling Job : " + job, module);
- rescheduled++;
- }
+ String pJobId = job.getString("parentJobId");
+ if (pJobId == null) {
+ pJobId = job.getString("jobId");
}
+ GenericValue newJob = GenericValue.create(job);
+ newJob.set("statusId", "SERVICE_PENDING");
+ newJob.set("runTime", now);
+ newJob.set("previousJobId", job.getString("jobId"));
+ newJob.set("parentJobId", pJobId);
+ newJob.set("startDateTime", null);
+ newJob.set("runByInstanceId", 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");
+ job.set("cancelDateTime", now);
+ delegator.store(job);
+
+ rescheduled++;
}
if (Debug.infoOn()) Debug.logInfo("-- " + rescheduled + " jobs
re-scheduled", module);