(OFBIZ-11200)
Before this commit, to purge old job we use the thread job manager to check
if some job need to be run and if the pool is empty, check the old job to purge.
I detected a problem when you have many job's server and more than one pool.
When you have a first pool that run regular job and a second that receive
huge asynchrone services (by persist call), the server who manage the second pool
have rarely the possibility to purge their jobs that, by the way, increase JobSandbox table.
The Server who manage the first pool, call often the purge process, but the table size
generate a long query time to purge few element. Long query time, run often,
this purge process load uselessly the database.
After analyze, I refactoring these following items :
* When you call JobSandbox table for a purge, use a limit on the query
with the max thread pool because when you have the database return,
you purge only with this limit so this help the database to not scan
the whole table. Other small improvement, do not sort the result
(no functional gain).
* Purge by the pool thread is nice, each server can only purge their
own job (filtered on run_by_instance_id), to help an overloaded server,
I was rehability purgeOldJobs service that it can run with specific
parameter to make assistance.
* Last, all job services are historical on class org.apache.ofbiz.service.ServiceUtil,
I moved them all in a new dedicate class org.apache.ofbiz.service.job.JobServices
269 lines
16 KiB
XML
269 lines
16 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.
|
|
-->
|
|
|
|
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
|
|
<description>OFBiz Service Engine Services</description>
|
|
<vendor>OFBiz</vendor>
|
|
<version>1.0</version>
|
|
|
|
<!-- Service Engine Services -->
|
|
<service name="purgeOldJobs" engine="java"
|
|
location="org.apache.ofbiz.service.job.JobServices" invoke="purgeOldJobs" auth="true" use-transaction="false" semaphore="wait">
|
|
<description>Cleans out old jobs which have been around longer then what is defined in serviceengine.xml</description>
|
|
<required-permissions join-type="AND">
|
|
<check-permission permission="SERVICE_INVOKE_ANY"/>
|
|
</required-permissions>
|
|
<attribute name="poolId" type="String" mode="IN" optional="true"/>
|
|
<attribute name="daysToKeep" type="Integer" mode="IN" optional="true"/>
|
|
<attribute name="limit" type="Integer" mode="IN" optional="true"/>
|
|
</service>
|
|
|
|
<service name="cancelScheduledJob" engine="java"
|
|
location="org.apache.ofbiz.service.job.JobServices" invoke="cancelJob" auth="true">
|
|
<description>Cancels a schedule job</description>
|
|
<required-permissions join-type="AND">
|
|
<check-permission permission="SERVICE_INVOKE_ANY"/>
|
|
</required-permissions>
|
|
<auto-attributes entity-name="JobSandbox" include="pk" mode="IN" optional="false"/>
|
|
<attribute name="cancelDateTime" type="Timestamp" mode="OUT" optional="false"/>
|
|
<attribute name="statusId" type="String" mode="OUT" optional="false"/> <!-- To more easily see current pending jobs and possibly cancel some others -->
|
|
</service>
|
|
|
|
<service name="cancelJobRetries" engine="java"
|
|
location="org.apache.ofbiz.service.job.JobServices" invoke="cancelJobRetries" auth="true">
|
|
<description>Cancels a job retry flag</description>
|
|
<required-permissions join-type="AND">
|
|
<check-permission permission="SERVICE_INVOKE_ANY"/>
|
|
</required-permissions>
|
|
<auto-attributes entity-name="JobSandbox" include="pk" mode="IN" optional="false"/>
|
|
</service>
|
|
|
|
<service name="resetScheduledJob" engine="java"
|
|
location="org.apache.ofbiz.service.job.JobServices" invoke="resetJob" auth="true">
|
|
<description>Resets a stale job so it can be re-run</description>
|
|
<required-permissions join-type="AND">
|
|
<check-permission permission="SERVICE_INVOKE_ANY"/>
|
|
</required-permissions>
|
|
<auto-attributes entity-name="JobSandbox" include="pk" mode="IN" optional="false"/>
|
|
</service>
|
|
|
|
<!-- Service Engine Interfaces -->
|
|
<service name="permissionInterface" engine="interface">
|
|
<description>Interface to describe base parameters for Permission Services</description>
|
|
<attribute name="mainAction" type="String" mode="IN" optional="true">
|
|
<description>The action requiring permission. Must be one of ADMIN, CREATE, UPDATE, DELETE, VIEW.</description>
|
|
</attribute>
|
|
<attribute name="primaryPermission" type="String" mode="IN" optional="true">
|
|
<description>The permission to check - typically the name of an application or entity.</description>
|
|
</attribute>
|
|
<attribute name="altPermission" type="String" mode="IN" optional="true">
|
|
<description>Optional alternate permission to check. If the primary permission check fails,
|
|
the alternate permission will be checked.</description>
|
|
</attribute>
|
|
<attribute name="resourceDescription" type="String" mode="IN" optional="true">
|
|
<description>The name of the resource being accessed - defaults to service name.</description>
|
|
</attribute>
|
|
<attribute name="hasPermission" type="Boolean" mode="OUT" optional="false">
|
|
<description>Contains true if the requested permission has been granted.</description>
|
|
</attribute>
|
|
<attribute name="failMessage" type="String" mode="OUT" optional="true">
|
|
<description>Contains an explanation if the permission was denied.</description>
|
|
</attribute>
|
|
</service>
|
|
|
|
<service name="authenticationInterface" engine="interface">
|
|
<description>Interface to describe authentication services</description>
|
|
<attribute name="login.username" type="String" mode="IN"/>
|
|
<attribute name="login.password" type="String" mode="IN" optional="true"/>
|
|
<attribute name="login.token" type="String" mode="IN" optional="true"/>
|
|
<attribute name="visitId" type="String" mode="IN" optional="true"/>
|
|
<attribute name="isServiceAuth" type="Boolean" mode="IN" optional="true"/>
|
|
<attribute name="userLogin" type="org.apache.ofbiz.entity.GenericValue" mode="OUT"/>
|
|
<attribute name="userLoginSession" type="java.util.Map" mode="OUT" optional="true"/>
|
|
</service>
|
|
|
|
<service name="serviceStreamInterface" engine="interface">
|
|
<description>Interface to describe services call with streams</description>
|
|
<attribute name="inputStream" type="java.io.InputStream" mode="IN"/>
|
|
<attribute name="outputStream" type="java.io.OutputStream" mode="IN"/>
|
|
<attribute name="contentType" type="String" mode="OUT"/>
|
|
</service>
|
|
|
|
<service name="serviceEcaConditionInterface" engine="interface">
|
|
<description>Interface to describe services which are used as SECA conditions</description>
|
|
<attribute name="serviceContext" type="Map" mode="IN"/>
|
|
<attribute name="serviceName" type="String" mode="IN"/>
|
|
<attribute name="conditionReply" type="Boolean" mode="OUT"/>
|
|
</service>
|
|
<service name="serviceMcaConditionInterface" engine="interface">
|
|
<description>Interface to describe services which are used as SMCA conditions</description>
|
|
<attribute name="messageWrapper" type="org.apache.ofbiz.service.mail.MimeMessageWrapper" mode="IN"/>
|
|
<attribute name="conditionReply" type="Boolean" mode="OUT"/>
|
|
</service>
|
|
|
|
<service name="mailProcessInterface" engine="interface">
|
|
<description>Interface to describe services used to process incoming email</description>
|
|
<attribute name="messageWrapper" type="org.apache.ofbiz.service.mail.MimeMessageWrapper" mode="IN"/>
|
|
</service>
|
|
|
|
<!-- simple condition implementation -->
|
|
<service name="effectiveDateEcaCondition" engine="java" auth="false" use-transaction="false"
|
|
location="org.apache.ofbiz.service.ServiceUtil" invoke="genericDateCondition">
|
|
<implements service="serviceEcaConditionInterface"/>
|
|
<attribute name="fromDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
|
|
<attribute name="thruDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
|
|
</service>
|
|
|
|
<!-- JobManagerLock Services -->
|
|
<service name="createJobManagerLock" default-entity-name="JobManagerLock" engine="entity-auto" invoke="create" auth="true">
|
|
<description>Create a Job Manager Lock</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="CREATE"/>
|
|
<auto-attributes include="pk" mode="IN" optional="false"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
|
|
<service name="updateJobManagerLock" default-entity-name="JobManagerLock" engine="entity-auto" invoke="update" auth="true">
|
|
<description>Cancel a Job Sandbox Lock</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="UPDATE"/>
|
|
<auto-attributes include="pk" mode="IN" optional="false"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
|
|
<service name="createCatalinaSession" default-entity-name="CatalinaSession" engine="entity-auto" invoke="create" auth="true">
|
|
<description>Create a Catalina Session Record</description>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
|
|
<service name="updateCatalinaSession" default-entity-name="CatalinaSession" engine="entity-auto" invoke="update" auth="true">
|
|
<description>Update a Catalina Session Record</description>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteCatalinaSession" default-entity-name="CatalinaSession" engine="entity-auto" invoke="delete" auth="true">
|
|
<description>Delete a Catalina Session Record</description>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
|
|
<!-- StandardLanguage services -->
|
|
<service name="createStandardLanguage" default-entity-name="StandardLanguage" engine="entity-auto" invoke="create" auth="true">
|
|
<description>Create a StandardLanguage Record</description>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="updateStandardLanguage" default-entity-name="StandardLanguage" engine="entity-auto" invoke="update" auth="true">
|
|
<description>Update a StandardLanguage Record</description>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteStandardLanguage" default-entity-name="StandardLanguage" engine="entity-auto" invoke="delete" auth="true">
|
|
<description>Delete a StandardLanguage Record</description>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
</service>
|
|
|
|
<!-- StatusItem services -->
|
|
<service name="createStatusItem" default-entity-name="StatusItem" engine="entity-auto" invoke="create" auth="true">
|
|
<description>Create a StatusItem Record</description>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="updateStatusItem" default-entity-name="StatusItem" engine="entity-auto" invoke="update" auth="true">
|
|
<description>Update a StatusItem Record</description>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteStatusItem" default-entity-name="StatusItem" engine="entity-auto" invoke="delete" auth="true">
|
|
<description>Delete a StatusItem Record</description>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
</service>
|
|
|
|
<service name="createStatusType" default-entity-name="StatusType" engine="entity-auto" invoke="create" auth="true">
|
|
<description>Create a StatusType</description>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="updateStatusType" default-entity-name="StatusType" engine="entity-auto" invoke="update" auth="true">
|
|
<description>Update a StatusType</description>
|
|
<auto-attributes include="pk" mode="IN" optional="false"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteStatusType" default-entity-name="StatusType" engine="entity-auto" invoke="delete" auth="true">
|
|
<description>Delete a StatusType</description>
|
|
<auto-attributes include="pk" mode="IN" optional="false"/>
|
|
</service>
|
|
|
|
<service name="createSequenceValueItem" default-entity-name="SequenceValueItem" engine="entity-auto" invoke="create" auth="true">
|
|
<description>Create a SequenceValueItem</description>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="updateSequenceValueItem" default-entity-name="SequenceValueItem" engine="entity-auto" invoke="update" auth="true">
|
|
<description>Update a SequenceValueItem</description>
|
|
<auto-attributes include="pk" mode="IN" optional="false"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteSequenceValueItem" default-entity-name="SequenceValueItem" engine="entity-auto" invoke="delete" auth="true">
|
|
<description>Delete a SequenceValueItem</description>
|
|
<auto-attributes include="pk" mode="IN" optional="false"/>
|
|
</service>
|
|
|
|
<!-- JobSandbox Services -->
|
|
<service name="createJobSandbox" engine="entity-auto" invoke="create" default-entity-name="JobSandbox" auth="true">
|
|
<description>Create JobSandbox record</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="CREATE"/>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="updateJobSandbox" engine="entity-auto" invoke="update" default-entity-name="JobSandbox" auth="true">
|
|
<description>Update JobSandbox record</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="UPDATE"/>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteJobSandbox" engine="entity-auto" invoke="delete" default-entity-name="JobSandbox" auth="true">
|
|
<description>Delete JobSandbox record</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="DELETE"/>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
</service>
|
|
|
|
<!-- RuntimeData Services -->
|
|
<service name="createRuntimeData" engine="entity-auto" invoke="create" default-entity-name="RuntimeData" auth="true">
|
|
<description>Create RuntimeData record</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="CREATE"/>
|
|
<auto-attributes include="pk" mode="INOUT" optional="true"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
<override name="runtimeInfo" allow-html="any"></override>
|
|
</service>
|
|
<service name="updateRuntimeData" engine="entity-auto" invoke="update" default-entity-name="RuntimeData" auth="true">
|
|
<description>Update RuntimeData record</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="UPDATE"/>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
<auto-attributes include="nonpk" mode="IN" optional="true"/>
|
|
</service>
|
|
<service name="deleteRuntimeData" engine="entity-auto" invoke="delete" default-entity-name="RuntimeData" auth="true">
|
|
<description>Delete RuntimeData record</description>
|
|
<permission-service service-name="commonGenericPermission" main-action="DELETE"/>
|
|
<auto-attributes include="pk" mode="IN"/>
|
|
</service>
|
|
|
|
</services>
|