I have code like this:
private final ThreadPoolTaskScheduler threadPoolTaskScheduler; // spring
private final LockingTaskExecutor lockingTaskExecutor; // shedlock
....
threadPoolTaskScheduler.scheduleWithFixedDelay(
() -> {
lockConfiguration = ...
long start = System.currentTimeMillis();
LOGGER.info("Spring scheduler started task, awaiting shedlock ");
lockingTaskExecutor.executeWithLock((Runnable) () -> {
LOGGER.info("Shedlock acquired. duration=[{}]ms", propertyItem, System.currentTimeMillis() - start);
taks();
},
lockConfiguration);
}, someInterval);
I have 2 nodes. According logs I see situation that task()
works only on first node. On second node I see only Spring scheduler started task, awaiting shedlock
I believe it should not work in a such way and I want to investigate why it happens.
How can I subscribe on event when lock is released?
How long shedlock tries to acquire lock?
someInterval = 30 minutes
lockConfiguration: atleast = 5 min, atMost=20min
I investigated source code and found out that shedlock tries to acquire lock and if lock busy it just skips the task