0

I have a spring boot application, I've generated the application with jhispter, I have a spring service that has a scheduled method as below:

@Scheduled(cron = "0 0/2 * * * *")
private void checkStatusRouters() {

    if(!IS_JOB_RUNNING){
        IS_JOB_RUNNING =true;
        log.info("[JOB-MONITOR] - Initializing scan", Instant.now());
        List<MicroTikRouter> routers = routerService.findAllEntities();
        log.info("Roteadores encontrados: {}",routers.size());
        for (MicroTikRouter router : routers) {
            try {
                log.info("Iniciando roteador : {}", router.getDescription());
                CompletableFuture<Boolean> check =  routerService.checkRouterStatusAsync(router);
                check.exceptionally(exception -> {
                    //HandleException
                });
            }
            catch(Exception ex){
                //Handle
            }
        }
}   }

This method calls many times the routerService.checkRouterStatusAsync() that is described below. (I dont need to wait the result of this method )

@Async
public CompletableFuture<Boolean> checkRouterStatusAsync(MicroTikRouter router) throws  ApiConnectionException,ApiCommandException,Exception {

    //neither this log is appearing
    log.info("Request print router {} : with ip/dns  {} ",router.getCode(),router.getIp());

    //make many things  

    return CompletableFuture.completedFuture(true);
}   

The strange thing is that nothing on the method checkRouterStatusAsync is appearing on the log.

That is happening only on my production server, locally it works. On both sides (locally and in production), I have Java 8 installed.

I run my application using the command java -jar {myPackage}.war.

Anyone can help me?

Didier L
  • 18,905
  • 10
  • 61
  • 103
makeItEasier
  • 216
  • 3
  • 18

0 Answers0