Quartz:多个共享资源的作业

问题描述 投票:0回答:1

我有多个工作,他们都共享相同的资源。该资源是一些特殊的构建脚本,因此不能同时运行。

是否有可能在Quartz中定义某些作业不能同时运行?

因此,如果其中一个作业已在运行,则生成的作业将排队。

java quartz-scheduler
1个回答
1
投票

好消息是Spring Boot具有针对石英的自动配置,因此从头开始不需要太多。

在您的pom中包含spring-boot-starter-quartz,您很高兴。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-quartz</artifactId>
</dependency>

在应用程序属性文件中,您可以使用spring.quartz.properties*配置石英以控制并发性。

spring.quartz.properties.org.quartz.threadPool.threadCount=1

您可以查看有关配置here的更多信息

© www.soinside.com 2019 - 2024. All rights reserved.