Files
ofbiz-framework/framework/service/entitydef/entitymodel.xml
T
Scott Gray ddcbb33de8 Implemented: Allow Jobs to specify a priority and be queued accordingly by the
JobPoller so that important jobs can be prioritized over normal jobs, and low 
priority jobs can be left until last. [OFBIZ-10865]

Changes are as follows:
* Add a "priority" field to JobSandbox entity (numeric/Long)
* Add JobPriority constants class containing fields LOW (0), NORMAL (50) and HIGH (100)
* Add getPriority method to the Job interface and implement methods for AbstractJob (returns NORMAL), PersistedServiceJob (returns JobSandbox.priority) and PurgeJob (returns LOW)
* Change the JobPoller executor's queue to use PriorityBlockingQueue (unbounded) instead of LinkedBlockingQueue (bounded)
* Implement custom Comparator for the priority queue to sort by priority descending and then runTime ascending
* Change the poll size per poll to be (queueSize() - queue.size) instead of queue.remainingCapacity() due to the new queue being unbounded
* I've also opted to limit the database poll query to the poll size using maxRows() because it seemed dangerous to me to use an unconstrained query on this table
* Ensured recurring jobs receive the default (NORMAL) priority when being rescheduled so that they're sorted correctly on the next time they show up in the database poll
* Ensured jobs generated at runtime are given a default priority of NORMAL



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857071 13f79535-47bb-0310-9956-ffa450edef68
2019-04-07 07:39:47 +00:00

220 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<!-- ========================================================= -->
<!-- ======================== Defaults ======================= -->
<!-- ========================================================= -->
<title>Entity of an Apache OFBiz Component</title>
<description>None</description>
<version>1.0</version>
<!-- ========================================================= -->
<!-- ======================== Data Model ===================== -->
<!-- The modules in this file are as follows: -->
<!-- - org.apache.ofbiz.service.schedule -->
<!-- - org.apache.ofbiz.service.semaphore -->
<!-- ========================================================= -->
<!-- ========================================================= -->
<!-- org.apache.ofbiz.service.schedule -->
<!-- ========================================================= -->
<entity entity-name="JobSandbox" package-name="org.apache.ofbiz.service.schedule" title="Job Scheduler Sandbox"
sequence-bank-size="100" never-cache="true">
<field name="jobId" type="id"></field>
<field name="jobName" type="name"></field>
<field name="runTime" type="date-time"></field>
<field name="priority" type="numeric"></field>
<field name="poolId" type="name"></field>
<field name="statusId" type="id"></field>
<field name="parentJobId" type="id"></field>
<field name="previousJobId" type="id"></field>
<field name="serviceName" type="name"></field>
<field name="loaderName" type="name"></field>
<field name="maxRetry" type="numeric"></field>
<field name="currentRetryCount" type="numeric"></field>
<field name="authUserLoginId" type="id-vlong"></field>
<field name="runAsUser" type="id-vlong"></field>
<field name="runtimeDataId" type="id"></field>
<field name="recurrenceInfoId" type="id"><description>Deprecated - use tempExprId instead</description></field>
<field name="tempExprId" type="id"><description>Temporal expression id</description></field>
<field name="currentRecurrenceCount" type="numeric"></field>
<field name="maxRecurrenceCount" type="numeric"></field>
<field name="runByInstanceId" type="id"></field>
<field name="startDateTime" type="date-time"></field>
<field name="finishDateTime" type="date-time"></field>
<field name="cancelDateTime" type="date-time"></field>
<field name="jobResult" type="value"></field>
<prim-key field="jobId"/>
<relation type="one" fk-name="JOB_SNDBX_RECINFO" rel-entity-name="RecurrenceInfo">
<key-map field-name="recurrenceInfoId"/>
</relation>
<relation type="one" fk-name="JOB_SNDBX_TEMPEXPR" rel-entity-name="TemporalExpression">
<key-map field-name="tempExprId"/>
</relation>
<relation type="one" fk-name="JOB_SNDBX_RNTMDTA" rel-entity-name="RuntimeData">
<key-map field-name="runtimeDataId"/>
</relation>
<relation type="one" fk-name="JOB_SNDBX_AUSRLGN" title="Auth" rel-entity-name="UserLogin">
<key-map field-name="authUserLoginId" rel-field-name="userLoginId"/>
</relation>
<relation type="one" fk-name="JOB_SNDBX_USRLGN" title="RunAs" rel-entity-name="UserLogin">
<key-map field-name="runAsUser" rel-field-name="userLoginId"/>
</relation>
<relation type="one" fk-name="JOB_SNDBX_STTS" rel-entity-name="StatusItem">
<key-map field-name="statusId"/>
</relation>
<index name="JOB_SNDBX_RUNSTAT">
<index-field name="runByInstanceId"/>
<index-field name="statusId"/>
</index>
</entity>
<entity entity-name="RecurrenceInfo"
package-name="org.apache.ofbiz.service.schedule"
title="Recurrence Info">
<field name="recurrenceInfoId" type="id"></field>
<field name="startDateTime" type="date-time"></field>
<field name="exceptionDateTimes" type="very-long"></field>
<field name="recurrenceDateTimes" type="very-long"></field>
<field name="exceptionRuleId" type="id"></field>
<field name="recurrenceRuleId" type="id"></field>
<field name="recurrenceCount" type="numeric"><description>Not recommended - more than one process could be using this RecurrenceInfo</description></field>
<prim-key field="recurrenceInfoId"/>
<relation type="one" fk-name="REC_INFO_RCRLE" rel-entity-name="RecurrenceRule">
<key-map field-name="recurrenceRuleId"/>
</relation>
<relation type="one" fk-name="REC_INFO_EX_RCRLE" title="Exception" rel-entity-name="RecurrenceRule">
<key-map field-name="exceptionRuleId" rel-field-name="recurrenceRuleId"/>
</relation>
</entity>
<entity entity-name="RecurrenceRule"
package-name="org.apache.ofbiz.service.schedule"
title="Recurrence Rule">
<field name="recurrenceRuleId" type="id"></field>
<field name="frequency" type="short-varchar"></field>
<field name="untilDateTime" type="date-time"></field>
<field name="countNumber" type="numeric"></field>
<field name="intervalNumber" type="numeric"></field>
<field name="bySecondList" type="very-long"></field>
<field name="byMinuteList" type="very-long"></field>
<field name="byHourList" type="very-long"></field>
<field name="byDayList" type="very-long"></field>
<field name="byMonthDayList" type="very-long"></field>
<field name="byYearDayList" type="very-long"></field>
<field name="byWeekNoList" type="very-long"></field>
<field name="byMonthList" type="very-long"></field>
<field name="bySetPosList" type="very-long"></field>
<field name="weekStart" type="short-varchar"></field>
<field name="xName" type="very-long"></field>
<prim-key field="recurrenceRuleId"/>
</entity>
<entity entity-name="RuntimeData" package-name="org.apache.ofbiz.service.schedule" title="Runtime Data"
sequence-bank-size="100">
<field name="runtimeDataId" type="id"></field>
<field name="runtimeInfo" type="very-long"></field>
<prim-key field="runtimeDataId"/>
</entity>
<!-- Note: TemporalExpression values should be treated as immutable.
In other words, they should be created once and left unmodified by user
interaction. -->
<entity entity-name="TemporalExpression"
package-name="org.apache.ofbiz.service.schedule"
title="Temporal Expression">
<field name="tempExprId" type="id"></field>
<field name="tempExprTypeId" type="id"></field>
<field name="description" type="description"></field>
<field name="date1" type="date-time"></field>
<field name="date2" type="date-time"></field>
<field name="integer1" type="numeric"></field>
<field name="integer2" type="numeric"></field>
<field name="string1" type="id"></field>
<field name="string2" type="id"></field>
<prim-key field="tempExprId"/>
</entity>
<entity entity-name="TemporalExpressionAssoc"
package-name="org.apache.ofbiz.service.schedule"
title="Temporal Expression Association">
<field name="fromTempExprId" type="id"><description>The "parent" expression</description></field>
<field name="toTempExprId" type="id"><description>The "child" expression</description></field>
<field name="exprAssocType" type="id"><description>Expression association type.
When applied to DIFFERENCE expression types, valid values are INCLUDE or EXCLUDE.
When applied to SUBSTITUTION expression types, valid values are INCLUDE, EXCLUDE, or SUBSTITUTE.
</description>
</field>
<prim-key field="fromTempExprId"/>
<prim-key field="toTempExprId"/>
<relation type="one" fk-name="TEMP_EXPR_FROM" rel-entity-name="TemporalExpression" title="From">
<key-map field-name="fromTempExprId" rel-field-name="tempExprId"/>
</relation>
<relation type="one" fk-name="TEMP_EXPR_TO" rel-entity-name="TemporalExpression" title="To">
<key-map field-name="toTempExprId" rel-field-name="tempExprId"/>
</relation>
</entity>
<view-entity entity-name="TemporalExpressionChild"
package-name="org.apache.ofbiz.service.schedule"
title="Temporal Expression Children View">
<member-entity entity-alias="TEA" entity-name="TemporalExpressionAssoc"/>
<member-entity entity-alias="TE" entity-name="TemporalExpression"/>
<alias-all entity-alias="TEA">
<exclude field="toTempExprId"/>
</alias-all>
<alias-all entity-alias="TE"/>
<view-link entity-alias="TEA" rel-entity-alias="TE">
<key-map field-name="toTempExprId" rel-field-name="tempExprId"/>
</view-link>
</view-entity>
<entity entity-name="JobManagerLock" package-name="org.apache.ofbiz.service.schedule" title="Lock Job Manager Scheduler">
<field name="instanceId" type="id"/>
<field name="fromDate" type="date-time"/>
<field name="thruDate" type="date-time"/>
<field name="reasonEnumId" type="id"/>
<field name="comments" type="comment"/>
<field name="createdDate" type="date-time"/>
<field name="createdByUserLogin" type="id-vlong"/>
<field name="lastModifiedDate" type="date-time"/>
<field name="lastModifiedByUserLogin" type="id-vlong"/>
<prim-key field="instanceId"/>
<prim-key field="fromDate"/>
<relation type="one" fk-name="JOBLK_ENUM_REAS" rel-entity-name="Enumeration" title="Reason">
<key-map field-name="reasonEnumId" rel-field-name="enumId"/>
</relation>
</entity>
<!-- ========================================================= -->
<!-- org.apache.ofbiz.service.semaphore -->
<!-- ========================================================= -->
<entity entity-name="ServiceSemaphore" package-name="org.apache.ofbiz.service.semaphore" title="Semaphore Lock"
sequence-bank-size="100">
<field name="serviceName" type="name"></field>
<field name="lockedByInstanceId" type="id"></field>
<field name="lockThread" type="name"></field>
<field name="lockTime" type="date-time"></field>
<prim-key field="serviceName"/>
</entity>
</entitymodel>