There is an application that run some process by scheduler, like we have multiple instances we choose shedlock to block other run the same process. However, is not working since sleuth provides an instances of Runnable which is TraceRunnable and the expected is ScheduledMethodRunnable. Any ideas to solve this?
class SpringLockConfigurationExtractor
@Override
public Optional<LockConfiguration> getLockConfiguration(Runnable task) {
if (task instanceof ScheduledMethodRunnable) {
ScheduledMethodRunnable scheduledMethodRunnable = (ScheduledMethodRunnable) task;
return getLockConfiguration(scheduledMethodRunnable.getTarget(), scheduledMethodRunnable.getMethod());
} else {
logger.debug("Unknown task type " + task);
}
return Optional.empty();
}
I talk with developer and follow documentation set the param interceptMode to PROXY_METHOD and its working. He mention that this will be the default value in future releases, in favor of avoid issues like this.
@EnableSchedulerLock(defaultLockAtMostFor = "PT5M", interceptMode = PROXY_METHOD)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With