Questions tagged [shedlock]

ShedLock assures that scheduled tasks are executed at most once at the same time.

ShedLock makes sure that scheduled tasks are executed at most once at the same time. If a task is being executed on one node, it acquires a lock which prevents execution of the same task from another node (or thread). If task is already being executed on one node, execution on other nodes does not wait, it is simply skipped.

ShedLock uses external store like Mongo, JDBC database, Redis, Hazelcast, ZooKeeper or anything with a JDBC driver.

https://github.com/lukas-krecan/ShedLock

https://www.baeldung.com/shedlock-spring

66 questions
1
vote
1 answer

Shedlock for locking Quartz scheduler

I am looking for a locking solution for my scheduled tasks. I cannot use the in-built Quartz mechanism as I am not using JDBC. I came across Shedlock, but it seems to be tightly integrated with Spring Scheduler. I also came across…
Alice
  • 95
  • 4
  • 12
1
vote
2 answers

Issue about Distributed lock by using ShedLock to have ThreadPoolTaskScheduler process multiple schedule tasks

I know ShedLock could be used to do distributed lock integrated with Spring as: @Scheduled(cron = "*/5 * * * * ?") @SchedulerLock(name = "exampleLock", lockAtLeastForString = "20000", lockAtMostForString = "30000") private void…
Dayton Wang
  • 2,332
  • 1
  • 12
  • 17
1
vote
0 answers

org.springframework.orm.ObjectOptimisticLockingFailureException in a transactional method with shedlock and hibernate in a Spring Job

I get many org.springframework.orm.ObjectOptimisticLockingFailureException in a Spring Boot 2.1 service. I have a job with Spring's @Scheduled, where I save not much addresses in a PostgreSQL with Hibernate. The delays are set to fixedDelay = 5000L,…
Dubstef
  • 75
  • 1
  • 3
  • 13
1
vote
1 answer

Shedlock: use lockAtMostForString from property file

I have code like this: private static final String FOURTEEN_MIN = "PT14M"; ... @Scheduled(cron = "0 */15 * * * *") @SchedulerLock(name = "scheduledTaskName", lockAtMostForString = FOURTEEN_MIN, lockAtLeastForString = FOURTEEN_MIN) public void…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
2 answers

Can Shedlock be used in a non Spring-boot app?

I've been trying to get Shedlock set up so that a certain process is only ever run from 1 instance of the app at a time, the app uses some springframework dependencies, but is not a spring-boot app. I've made the db table, set up the configuration,…
MCherebin
  • 3
  • 1
0
votes
2 answers

how to handle exception happened inside @SchedulerLock

We have Spring boot API which use Quartz and shedlock for our batch. We have bellow exception when it try to put lock for batch job and the database connection is not abvailable. we are using annotation @SchedulerLock(name = "AurCifBatchTask",…
Bruce Xie
  • 1
  • 1
0
votes
0 answers

ShedLock SchedulingConfigurer With Multiple Jobs

I have the following code where i get a list of Cronjobs from the DB and execute them programmatically using SchedulingConfigurer. Any pointers on spinning each task with its own LockableTaskScheduler? I tried with the below code, but it does not…
chaty
  • 41
  • 8
0
votes
0 answers

Thread Lock in Shedlock in Multi instance Environment

In multi instance environment(instances 4), two scheduler are spawning 4 threads. we need to have lock for these thread with respect to particular instance. Can you please suggest if shedlock will help here ?
Jagrut Dalwadi
  • 295
  • 1
  • 4
  • 17
0
votes
0 answers

Frequent scheduler across multiple instances

I need to code scheduler which will be run every 1.6s and have access to database across two instances of microservices written on java 11 with use of Spring Boot Framework. I have two possible realiazation in my mind: Use shedlock for job which…
Robert
  • 371
  • 1
  • 5
  • 15
0
votes
0 answers

ShedLock can't detect a Job

In my Spring Boot APP, I have 12 batch jobs. Each batch job execute at certain time of the day. Surprisingly out of these 12 jobs, only 1 of them is not detected by ShedLock, as a result it gets executed from all nodes running my APP. All 12 jobs…
John
  • 371
  • 3
  • 11
0
votes
1 answer

Zookeeper vs DynamoDB LockProvider

I am making changes to a Java project and it is not required to use DB for shedlock for running tasks at one node. Can I use only ZoopKeeperCurator to run the scheduled task at only one node at a time? I have earlier used JdbcTemplateLockProvider…
0
votes
0 answers

DynamoDB Shedlock Implementation

I am trying to solve the issue of Cron job running on different instances. I understand that we need to create a shedlock table, but I am unclear about the columns and table name to be used. I have read shedlock documentation and it says : Please…
0
votes
0 answers

How to perform custom shed lock?

Scenario: I have 5 aeroplanes. I need their information every 5 minutes using GET REST API. My app is deployed to multiple instances. With the default database Shedlock, the entire database table is locked for a single record. I want to have a…
JustLift
  • 153
  • 1
  • 7
  • 17
0
votes
1 answer

Spring-boot app with ShedLock on Cassandra, getting "NullPointerException: table can not be null"

I am trying to integrate shedlock in my spring boot project using a cassandra db. But I am getting the below error on application startup. 2022-11-18 17:35:29,162 [main] ERRR o.s.boot.SpringApplication - Application run…
0
votes
1 answer

Shedlock: What happens when scheduled tasks share the same shedlock ID?

An application in our domain has 2 specific scheduled tasks; one that is required to run every minute, and one heavy bulk operation to be performed in the middle of the night. As performing both operations at the same time would overload the…
Michiel
  • 2,914
  • 1
  • 18
  • 27