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

In which order are annotations processed by Spring AOP?

I have a method that has two annotations: @Transactional @SchedulerLock public void test() { // do something } I'm wondering what happens first. Will first be a transaction created and then the locking will happen, or the other way round? Or…
Oleg
  • 33
  • 4
1
vote
2 answers

Shedlock with Spring Cloud Function @PollableBean

I have recently switched the implementation of almost all our services to spring cloud function, and naturally that mean as well that all scheduled jobs have been converted to suppliers, for example from this @Scheduled(cron =…
WiredCoder
  • 916
  • 1
  • 11
  • 39
1
vote
1 answer

Shedlock failed to register a new scheduler to the database table. - throws "The task is not locked." error

I have configured Shedlock by adding dependencies to the POM.XML as follows: net.javacrumbs.shedlock shedlock-spring 4.29.0
user1250720
  • 363
  • 1
  • 5
  • 17
1
vote
2 answers

Shedlock only works on one instance, but not multiple

I would like to setup Shedlock to guard a sensitive process so that only ONE instance of the process ever runs even when multiple application processes are started. In my pom.xml
Jasper Citi
  • 1,673
  • 1
  • 23
  • 31
1
vote
0 answers

unlock when there is an exception with shedlock

I'm using shedlock to scheduling same job on node1 and node2.It is working fine but I want to unlock when there is a error in scheduling task. Here is my example: @Scheduled(cron = "0 49 14 * * *") @SchedulerLock(name = "unlock-when-error",…
hasankzl
  • 666
  • 4
  • 16
1
vote
2 answers

Create a daemon thread that runs in exactly one instance of a (possibly replicated) Spring Boot service

I have a Spring Boot service that is deployed in multiple instances. I want to have a continuously running "daemon thread" in exactly one of the instances. Should that instance go down, the thread should eventually (after a timeout) become active on…
Alex Krauss
  • 9,438
  • 4
  • 27
  • 31
1
vote
1 answer

Shedlock and temporary stop task(s)?

When running several scheduled tasks on multiple servers, Shedlock seems great, but sometimes, we need to halt some of the tasks for a short or long period too. Of course, it is possible to control each task with additional properties/flags, but my…
Joakim
  • 13
  • 2
1
vote
2 answers

ShedLock - Not Executing on Kubernetes

I'm using Shedlock version 4.22.0 with JDBC integration. I have one configuration class @Configuration @EnableScheduling @EnableSchedulerLock(defaultLockAtMostFor = "PT30S") public class ShedLockConfiguration { @Bean public LockProvider…
1
vote
1 answer

Deadlock while purging old records of spring batch job tables at scheduled time using shedlock

I came across this challenging scenario wherein the transaction gets locked by Microsfoft sql server while executing a batch update query. I see this error. Transaction (Process ID 293) was deadlocked on lock resources with another process and has…
Saawan
  • 363
  • 6
  • 24
1
vote
0 answers

Scheduled job is not starting

I have been trying to implement the Shedlock on my spring boot application with no apparent use, I have used the formal guide available on https://github.com/lukas-krecan/ShedLock, please find below my configurations Maven Dependencies: …
WiredCoder
  • 916
  • 1
  • 11
  • 39
1
vote
1 answer

No qualifying bean of type LockProvider while configuring Spring Scheduler with Shedlock

I am trying to integrate Shedlock to make scheduled job on my Spring boot application run seamlessly in multi pod deployments. Main class is as follows: @SpringBootApplication @EnableScheduling @EnableSchedulerLock(defaultLockAtMostFor = "60m",…
Joy
  • 4,197
  • 14
  • 61
  • 131
1
vote
2 answers

Spring Shedlock does not ensure synchronization

I have following scheduled job which runs in multiple instances. @Scheduled(fixedRate = 10000) @SchedulerLock(name = "AwesomeJob", lockAtLeastForString = "5S", lockAtMostForString = "5S") public void awesomeJob() throws InterruptedException { …
1
vote
1 answer

shedlock - using without spring @Scheduled annotation

I am trying to figure out how to utilize shedlock (4.0.0 version) without spring's @scheduled annotation. I am implementing SchedulingConfigurer.configureTasks as below to add a trigger task for my scheduled method. @Component public class…
Kunjal Shah
  • 166
  • 1
  • 5
1
vote
2 answers

Shedlock has run duplicate when run multi instance

I am using shedlock to make sure only 1 Schedule Task can run at same time when I have multi instances net.javacrumbs.shedlock shedlock-spring 4.5.2
user3611168
  • 335
  • 1
  • 6
  • 27
1
vote
1 answer

What to use instead of ScheduledLockConfiguration Bean , in shedlock-spring 3.0?

I have a ScheduledLockConfiguration bean configuration. @Bean public ScheduledLockConfiguration taskScheduler(LockProvider lockProvider) { return ScheduledLockConfigurationBuilder .withLockProvider(lockProvider) .withPoolSize(5) …
Gábor Csikós
  • 2,787
  • 7
  • 31
  • 57