Skip to content

Backend - executions - Methods having both @Async and @Schedulled annotations #589

Open
@tomas-knap

Description

@tomas-knap

In backend, tasks are schedulled via Spring - so there is @scheduled method in Engine examining new executions every 2s and also @scheduled method in Scheduler, which check periodically (every 30s) whether new execution should be started (based on schedulled executions).

See also: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html

But @scheduled methods have also @async annotations. Is that needed as such methods are anyway executed in a separate thread?

Also backend-context.xml contains definition for executor (used for @async methods) and scheduler (used for @scheduled methods) (see below). Are both these thread pools needed? Take into account that Engine, executing new tasks, is anyway using Executors.newCachedThreadPool(); to create new pool of threads for running the executions.

<!-- we use annotations to run tasks -->
<task:annotation-driven executor="taskExecutor" scheduler="taskScheduler"/>
<!-- Used for asynch calls even for scheduled functions. -->
<task:executor id="taskExecutor" pool-size="8"/>
<!-- Used for Scheduled tasks.-->
<bean id="taskScheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
    <property name="poolSize" value="8" />
    <property name="waitForTasksToCompleteOnShutdown" value="false" />
    <property name="daemon" value="true" />
</bean>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions