[
https://issues.apache.org/jira/browse/OFBIZ-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jacques Le Roux closed OFBIZ-10865.
-----------------------------------
Thanks Scott, closing :)
> Allow prioritization of background jobs
> ---------------------------------------
>
> Key: OFBIZ-10865
> URL: https://issues.apache.org/jira/browse/OFBIZ-10865
> Project: OFBiz
> Issue Type: Improvement
> Components: framework
> Reporter: Scott Gray
> Assignee: Scott Gray
> Priority: Major
> Fix For: Upcoming Branch
>
> Attachments: OFBIZ-10865.diff
>
>
> As discussed on the dev list [1], 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.
> This is a first pass implementation with just the main changes. We will
> still need to allow the priority to be set in the JobManager and
> LocalDispatcher's "schedule" methods before jobs generated at runtime can be
> prioritized. IMO the existing schedule methods are a mess and need to be
> converted into a builder pattern before adding any more job attributes. The
> new priority field also needs to be added to the webtools UI wherever
> appropriate.
> 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
> [1]
> https://lists.apache.org/thread.html/f9107f8ca9a17a2df731337fc3d9766ebad33467fea4393fb069552d@%3Cdev.ofbiz.apache.org%3E
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)