Alternative for @DisallowConcurrentExecution

28 Views Asked by At

I am looking for an alternative for @DisallowConcurrentExecution. I have seen that a StatefulJob is an alternative but it is deprecated.

Let's say my job class is like:

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.ZonedDateTime;
@DisallowConcurrentExecution
public class AJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(AJob.class);

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("Scheduler output: " + ZonedDateTime.now().toString());
    }
}

Here, I want the same functionality without @DisallowConcurrentExecution annotation.

Help if there is a valid alternative

0

There are 0 best solutions below