unlock when there is an exception with shedlock

553 Views Asked by At

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", lockAtMostFor = "14m",lockAtLeastFor="4m")
    public void deviceMasterJob() {
    try{
        .... // do something
     }catch(Exception e){
     ... // do something to unlock 
     }
     ... // if there is no exception keep with lock

 }

Is there any way to unlock manually? how can I make this work?

Thanks for helping.

0

There are 0 best solutions below