1

I'm using Spring Boot release 4 and I use cron jobs I have some jobs like:

@Scheduled(initialDelay=5000,fixedDelay=5)
public void SendSmsPluto()  {

    logger.info(" ** CronJobs.SendSmsPluto is started");

    sbean.testSend();

    logger.info(" ** CronJobs.SendSmsPluto is ended");
}


@Scheduled(initialDelay=10000,fixedDelay=10000)
public void getSmsPlutoStc(){

    logger.info(" ** CronJobs.getSmsPlutoStc is started");

    sbean.PlutoQuery(new Long(4));

    logger.info(" ** CronJobs.getSmsPlutoStc is ended");
}

@Scheduled(initialDelay=13000,fixedDelay=10000)
public void getSmsPlutoZ(){

    logger.info(" ** CronJobs.getSmsPlutoStc is started");

    sbean.PlutoQuery(new Long(5));

    logger.info(" ** CronJobs.getSmsPlutoStc is ended");
}

@Scheduled(initialDelay=15000,fixedDelay=10000)
public void getSmsPlutoZI(){

    logger.info(" ** CronJobs.getSmsPlutoStc is started");

    sbean.PlutoQuery(new Long(6));

    logger.info(" ** CronJobs.getSmsPlutoStc is ended");
}

These cron jobs worked well but after a long time, maybe 2 or 3 days, they stopped. When I look at the log file, I find for example one of them start and not ended so the remainder stopped.

Smajl
  • 7,555
  • 29
  • 108
  • 179
  • 1
    Maybe there was a connection time out error, and that's why cron job stopped, make sure you are setting connection timeout error before connecting somewhere. – Pmakari May 17 '17 at 14:29
  • fixedDelay is accurate the next job will start after the first finished so it's mean i wait about 5 ms after fininshed – Sherif Thabet May 17 '17 at 14:58
  • @ParvizMakari where i can set time out connection – Sherif Thabet May 17 '17 at 15:01
  • it depends on where you're connecting, I mean database, httpconnection...based on the source, set timeout connection – Pmakari May 17 '17 at 15:04
  • @ParvizMakari yes i have connection pool and set time out connection and in another method i have httpconnection but i not setting time out for it – Sherif Thabet May 17 '17 at 15:07
  • refer this answer, here someone suggested how to set timeout connection http://stackoverflow.com/questions/17909404/spring-scheduler-stops-unexpectedly – Pmakari May 17 '17 at 15:14

0 Answers0