Merge pull request #15321 from panos-kakos/JAVA-26711

[JAVA-26711] Upgraded shedlock to latest version(5.10.0)
This commit is contained in:
Kasra Madadipouya 2023-12-04 08:24:54 +01:00 committed by GitHub
commit c6307d20ae
5 changed files with 11 additions and 16 deletions

View File

@ -225,7 +225,7 @@
<git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version> <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
<modelmapper.version>3.2.0</modelmapper.version> <modelmapper.version>3.2.0</modelmapper.version>
<problem-spring-web.version>0.23.0</problem-spring-web.version> <problem-spring-web.version>0.23.0</problem-spring-web.version>
<shedlock.version>2.1.0</shedlock.version> <shedlock.version>5.10.0</shedlock.version>
<barbecue.version>1.5-beta1</barbecue.version> <barbecue.version>1.5-beta1</barbecue.version>
<barcode4j.version>2.1</barcode4j.version> <barcode4j.version>2.1</barcode4j.version>
<qrgen.version>2.6.0</qrgen.version> <qrgen.version>2.6.0</qrgen.version>

View File

@ -1,13 +1,13 @@
package com.baeldung.scheduling.shedlock; package com.baeldung.scheduling.shedlock;
import net.javacrumbs.shedlock.core.SchedulerLock; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
class BaeldungTaskScheduler { class BaeldungTaskScheduler {
@Scheduled(cron = "0 0/15 * * * ?") @Scheduled(cron = "0 0/15 * * * ?")
@SchedulerLock(name = "TaskScheduler_scheduledTask", lockAtLeastForString = "PT5M", lockAtMostForString = "PT14M") @SchedulerLock(name = "TaskScheduler_scheduledTask", lockAtLeastFor = "PT5M", lockAtMostFor = "PT14M")
public void scheduledTask() { public void scheduledTask() {
System.out.println("Running ShedLock task"); System.out.println("Running ShedLock task");
} }

View File

@ -1,6 +1,6 @@
spring: spring:
datasource: datasource:
driverClassName: org.h2.Driver driverClassName: org.h2.Driver
url: jdbc:h2:mem:shedlock_DB;INIT=CREATE SCHEMA IF NOT EXISTS shedlock;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE url: jdbc:h2:mem:shedlock_db;INIT=CREATE SCHEMA IF NOT EXISTS shedlock;DATABASE_TO_UPPER=false;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: sa username: sa
password: password:

View File

@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS shedlock(
name VARCHAR(64) NOT NULL,
lock_until TIMESTAMP NOT NULL,
locked_at TIMESTAMP NOT NULL,
locked_by VARCHAR(255) NOT NULL,
PRIMARY KEY (name)
);

View File

@ -119,17 +119,6 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- ShedLock -->
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
<version>${shedlock.version}</version>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-provider-jdbc-template</artifactId>
<version>${shedlock.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
@ -162,7 +151,6 @@
<annotation-api.version>1.3.2</annotation-api.version> <annotation-api.version>1.3.2</annotation-api.version>
<!-- util --> <!-- util -->
<easymock.version>3.6</easymock.version> <easymock.version>3.6</easymock.version>
<shedlock.version>2.1.0</shedlock.version>
<javassist.version>3.22.0-GA</javassist.version> <javassist.version>3.22.0-GA</javassist.version>
<maven-war-plugin.version.version>3.2.2</maven-war-plugin.version.version> <maven-war-plugin.version.version>3.2.2</maven-war-plugin.version.version>
</properties> </properties>