How to work with Scheduled Parole?

Asked

Viewed 32 times

0

This guy is the Scheduled, he is triggered when the project is executed. Just as he is is in the automatic. I wish instead of being on automatic be triggered only when called, someone has an idea of how could do this?

@Scheduled(cron="*/50 * 02-23 ? * *")  // 10 em 10 segundos executa das 02:00 horas até as 23:00 (23:59) 
public void processarJOB() {
        System.out.println("inicio processarJOB --> processando: "  + new Timestamp(new Date().getTime()));
        Locale.setDefault(new Locale("pt", "BR"));
        try {
            if(!executandoJob) {
                executandoJob = true;
                processarPrestacao();
                executandoJob = false;
            }
        } catch (Exception e) {
            executandoJob = false;
            logger.error("" , e);
        }
    }
  • Do you want to enable scheduling after a user action for example? That’s it?

  • Positive, that’s right, I found something similar, but still do not understand how to adapt to the context of my code. https://stackoverflow.com/questions/18406713/how-to-conditionally-enable-or-disable-scheduled-jobs-in-spring

  • Dude, I know I can do just that and I’m gonna need that too, so I’ll research. If I can find the solution I put here.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.