Running a Task Concurrently

By default, the configured tasks are allowed to run concurrently in the Services Framework. A custom task can optionally override the following method to specify whether tasks can be run concurrently:
public  boolean  canRunConcurrently()

Services Framework allows the configured tasks to run concurrently if the method returns the value of true. If the custom task overrides the method with a return value of false, tasks do not run concurrently.

Example

Register a new task. Create a new task configuration against the registered task. When a configured task is initiated to run through the event handler, scheduler, or manually through the user interface, Services Framework verifies whether the task is allowed to run concurrently. If the canRunConcurrently( ) method returns a value of true, it invokes the runTask( ) method on the task, even if another other task instance run is not complete. If the canRunConcurrently( ) method returns a value of false, it checks for any task instance of the registered class type currently running. If the task instance is running, it errors out the new task run request and creates a task activity record with the task lock error. If the task instance is not running, it creates a lock and invokes the runTask( ) method and unlocks it when the runTask( ) method is returned. Customers can manually unlock the registered class through user interface. If a server has errors that occur during the task run, the locks are not deleted. In such cases, the customer must unlock them manually through the Services Framework task registration screen. If unlocking the class name, the tasks may produce unwanted results if they have run concurrently and were not designed to run concurrently. Services Framework performs the concurrency control only on the runTask( ) method invocations for the task. It does not control the concurrency of other methods for the task, such as endOfDayQuery( ) or endOfDayExec( ).