Don't use EELFLoggerDelegate.errorLogger in Async jobs
[vid.git] / vid-app-common / src / main / java / org / onap / vid / job / impl / JobSchedulerInitializer.java
index b3ab75b..bd82ffa 100644 (file)
 
 package org.onap.vid.job.impl;
 
+import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
+
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import javax.annotation.PostConstruct;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.vid.exceptions.GenericUncheckedException;
 import org.onap.vid.job.Job;
 import org.onap.vid.job.JobsBrokerService;
 import org.onap.vid.job.command.JobCommandFactory;
-import org.quartz.*;
+import org.quartz.JobBuilder;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.quartz.SchedulerFactoryBean;
 import org.springframework.stereotype.Component;
 import org.togglz.core.manager.FeatureManager;
 
-import javax.annotation.PostConstruct;
-import java.util.List;
-
-import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
-
 @Component
 public class JobSchedulerInitializer {
 
@@ -46,6 +51,14 @@ public class JobSchedulerInitializer {
     private FeatureManager featureManager;
     private JobCommandFactory jobCommandFactory;
     private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JobSchedulerInitializer.class);
+    public static final List<Job.JobStatus> WORKERS_TOPICS = ImmutableList.of(
+            Job.JobStatus.PENDING,
+            Job.JobStatus.CREATING,
+            Job.JobStatus.IN_PROGRESS,
+            Job.JobStatus.RESOURCE_IN_PROGRESS,
+            Job.JobStatus.PENDING_RESOURCE
+    );
+
 
     @Autowired
     public JobSchedulerInitializer(
@@ -61,14 +74,6 @@ public class JobSchedulerInitializer {
 
     }
 
-    public static final List<Job.JobStatus> WORKERS_TOPICS = ImmutableList.of(
-            Job.JobStatus.PENDING,
-            Job.JobStatus.CREATING,
-            Job.JobStatus.IN_PROGRESS,
-            Job.JobStatus.RESOURCE_IN_PROGRESS,
-            Job.JobStatus.PENDING_RESOURCE
-    );
-
     @PostConstruct
     public void init() {
         WORKERS_TOPICS.forEach(topic->scheduleJobWorker(topic, 1));
@@ -94,7 +99,7 @@ public class JobSchedulerInitializer {
         try {
             scheduler.scheduleJob(jobDetail, asyncWorkerTrigger);
         } catch (SchedulerException e) {
-            logger.error(EELFLoggerDelegate.errorLogger, "Failed to schedule trigger for async worker jobs: {}", e.getMessage());
+            logger.error("Failed to schedule trigger for async worker jobs: {}", e.getMessage());
             throw new GenericUncheckedException(e);
         }
     }