cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CronJob using ExecutorService Logging (Slf4j)

Former Member
0 Likes
557

Hi Experts,

I have a cronJob in which I execute a Callable from an ExecutorService as follows:

 final ExecutorService executor = Executors.newFixedThreadPool(nbProcessors, getTenantAwareThreadFactory());
 int size = productList.size();
         int step = size / nbProcessors;
         int startIndex;
         int endIndex;
         
         List<Future<IceWorkerResultData>> futures = new ArrayList<>();
 
         for (int i = 0; i < nbProcessors; i++) {
            startIndex = i * step;
            if (i == nbProcessors -1) {
               endIndex = size; 
            }
            else {
               endIndex = (i + 1) * step; 
            }
            
            futures.add(executor.submit(new IceWorkerTask(startIndex, endIndex, productList, cronJob, dept, resolveType, pidNotUpdated, isKsaBaseStore, apiUrl, authLogon, authKey)));
         }
         
         executor.shutdown();

In this Calloable (IceWorkerTask) I have log Info appended in a file and which is no longer displayed. On the other hand, before without the use of ExecutorService and Callable (Without threads) the log is displayed perfectly

Here are my cronjob configuration :

Thanks in advance.

Accepted Solutions (0)

Answers (0)