Author: jleroux
Date: Sun Apr 8 20:21:34 2012 New Revision: 1311082 URL: http://svn.apache.org/viewvc?rev=1311082&view=rev Log: A patch from Nicolas Malin "Use flexibleStringRenderer for alt-target element on form" https://issues.apache.org/jira/browse/OFBIZ-4588 At this time the alt-target element value is only parse on bsh interpreter. To resynchronise with the rest of framework, convert with a flexibleStringRenderer. 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=1311082&r1=1311081&r2=1311082&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 Sun Apr 8 20:21:34 2012 @@ -208,6 +208,7 @@ public class JobManager { public synchronized void reloadCrashedJobs() { String instanceId = UtilProperties.getPropertyValue("general.properties", "unique.instanceId", "ofbiz0"); List<GenericValue> crashed = null; + List<GenericValue> pending = null; List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("runByInstanceId", instanceId)); exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "SERVICE_RUNNING")); @@ -219,10 +220,41 @@ public class JobManager { Debug.logError(e, "Unable to load crashed jobs", module); } + exprs = UtilMisc.toList(EntityCondition.makeCondition("runByInstanceId", instanceId)); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "SERVICE_PENDING")); + ecl = EntityCondition.makeCondition(exprs); + + try { + pending = delegator.findList("JobSandbox", ecl, null, UtilMisc.toList("startDateTime"), null, false); + } catch (GenericEntityException e) { + Debug.logError(e, "Unable to load pending jobs", module); + } + + if (UtilValidate.isNotEmpty(crashed)) { try { int rescheduled = 0; for (GenericValue job: crashed) { + + // We don't reload a crashed job if a pending job with same service name and + // recurrenceInfoId or tempExprId exists + String serviceName = job.getString("serviceName"); + String recurrenceInfoId = job.getString("recurrenceInfoId"); + String tempExprId = job.getString("tempExprId"); + if (UtilValidate.isNotEmpty(pending)) { + for (GenericValue parentJob: pending) { + String parentServiceName = parentJob.getString("serviceName"); + String parentRecurrenceInfoId = parentJob.getString("recurrenceInfoId"); + String parentTempExprId = parentJob.getString("tempExprId"); + if (serviceName.equals(parentServiceName) + && recurrenceInfoId.equals(parentRecurrenceInfoId) || tempExprId.equals(parentTempExprId)) { + continue; + } + } + } + + if (0 == job.getLong("maxRetry").longValue()) continue; + Timestamp now = UtilDateTime.nowTimestamp(); Debug.log("Scheduling Job : " + job, module); |
Free forum by Nabble | Edit this page |