aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusService.java16
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializer.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/impl/JobSchedulerInitializer.java19
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java10
10 files changed, 35 insertions, 33 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusService.java b/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusService.java
index 3d1d78f8b..91bf5de1e 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusService.java
@@ -20,6 +20,11 @@
package org.onap.vid.job.command;
+import static org.onap.vid.utils.TimeUtils.parseZonedDateTime;
+
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeParseException;
+import java.util.UUID;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.vid.job.Job;
import org.onap.vid.job.impl.JobSharedData;
@@ -33,12 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.togglz.core.manager.FeatureManager;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeParseException;
-import java.util.UUID;
-
-import static org.onap.vid.utils.TimeUtils.parseZonedDateTime;
-
@Service
public class InProgressStatusService {
@@ -86,8 +85,7 @@ public class InProgressStatusService {
public void handleFailedMsoResponse(UUID jobUUID, String requestId, RestObject<AsyncRequestStatus> msoResponse) {
auditService.setFailedAuditStatusFromMso(jobUUID, requestId, msoResponse.getStatusCode(), msoResponse.getRaw());
- LOGGER.error(EELFLoggerDelegate.errorLogger,
- "Failed to get orchestration status for {}. Status code: {}, Body: {}",
+ LOGGER.error("Failed to get orchestration status for {}. Status code: {}, Body: {}",
requestId, msoResponse.getStatusCode(), msoResponse.getRaw());
}
@@ -108,7 +106,7 @@ public class InProgressStatusService {
try {
jobStartTime = parseZonedDateTime(asyncRequestStatusResponse.get().request.startTime);
} catch (DateTimeParseException | NullPointerException e) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to parse start time for {}, body: {}. Current time will be used", requestId, asyncRequestStatusResponse.getRaw(), e);
+ LOGGER.error("Failed to parse start time for {}, body: {}. Current time will be used", requestId, asyncRequestStatusResponse.getRaw(), e);
jobStartTime = ZonedDateTime.now();
}
return jobStartTime;
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt
index 2fdd19100..8ce73d713 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt
@@ -62,13 +62,13 @@ class MacroServiceCommand @Autowired constructor(
//Aai return bad response while checking names uniqueness
catch (exception : ExceptionWithRequestInfo) {
- Logger.error(EELFLoggerDelegate.errorLogger, "Failed to check name uniqueness in AAI. VID will try again later", exception)
+ Logger.error("Failed to check name uniqueness in AAI. VID will try again later", exception)
throw TryAgainException(exception);
}
//Vid reached to max retries while trying to find unique name in AAI
catch (exception : MaxRetriesException) {
- Logger.error(EELFLoggerDelegate.errorLogger, "Failed to find unused name in AAI", exception)
+ Logger.error("Failed to find unused name in AAI", exception)
throw AbortingException(exception);
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
index 063ef6e53..c3fdcdaeb 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
@@ -210,7 +210,7 @@ class MsoRequestBuilder
try {
asyncInstantiationBL.updateServiceInfo(jobId) { x -> x.serviceInstanceName = serviceInstanceName }
} catch (e: Exception) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed updating service name {} in serviceInfo", serviceInstanceName, e)
+ LOGGER.error("Failed updating service name {} in serviceInfo", serviceInstanceName, e)
}
return serviceInstanceName
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
index 4477a9f24..2b5ec0127 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
@@ -153,7 +153,7 @@ abstract class ResourceCommand(
JobStatus.IN_PROGRESS
}
catch (exception: AbortingException) {
- Logger.error(EELFLoggerDelegate.errorLogger, "caught AbortingException. Set job status to FAILED")
+ Logger.error("caught AbortingException. Set job status to FAILED")
JobStatus.FAILED;
}
}
@@ -330,13 +330,13 @@ abstract class ResourceCommand(
handleInProgressStatus(jobStatus)
} catch (e: javax.ws.rs.ProcessingException) {
// Retry when we can't connect MSO during getStatus
- Logger.error(EELFLoggerDelegate.errorLogger, "Cannot get orchestration status for {}, will retry: {}", requestId, e, e)
+ Logger.error("Cannot get orchestration status for {}, will retry: {}", requestId, e, e)
JobStatus.IN_PROGRESS;
} catch (e: InProgressStatusService.BadResponseFromMso) {
inProgressStatusService.handleFailedMsoResponse(sharedData.jobUuid, requestId, e.msoResponse)
JobStatus.IN_PROGRESS
} catch (e: RuntimeException) {
- Logger.error(EELFLoggerDelegate.errorLogger, "Cannot get orchestration status for {}, stopping: {}", requestId, e, e)
+ Logger.error("Cannot get orchestration status for {}, stopping: {}", requestId, e, e)
JobStatus.STOPPED
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt
index 875de66d6..c4680b2bd 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt
@@ -71,13 +71,13 @@ abstract class RootServiceCommand @Autowired constructor(
try {
val requests = auditService.retrieveRequestsFromMsoByServiceIdAndRequestTypeAndScope(serviceInstanceId, requestType, scope)
if (requests.isEmpty() || requests[0].requestId == null) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to retrieve requestId with type: $type, scope: $scope for service instanceId $serviceInstanceId ")
+ LOGGER.error("Failed to retrieve requestId with type: $type, scope: $scope for service instanceId $serviceInstanceId ")
return Job.JobStatus.FAILED
}
val createMyselfCommand = planResumeMyselfRestCall(requests[0].requestId, sharedData.userId)
return executeAndHandleMsoInstanceRequest(createMyselfCommand)
} catch (exception: Exception) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to resume instanceId $serviceInstanceId ", exception)
+ LOGGER.error("Failed to resume instanceId $serviceInstanceId ", exception)
return Job.JobStatus.FAILED
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt
index 68c9f53e1..29d7001e2 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt
@@ -193,7 +193,7 @@ class VfmoduleCommand @Autowired constructor(
val replaceMyselfCommand = planReplaceMyselfRestCall(commandParentData)
return executeAndHandleMsoInstanceRequest(replaceMyselfCommand)
} catch (exception: Exception) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to replace instanceId ${getRequest().instanceId} ", exception)
+ LOGGER.error("Failed to replace instanceId ${getRequest().instanceId} ", exception)
return Job.JobStatus.FAILED
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt
index c947bc0d5..9023682f6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt
@@ -61,8 +61,7 @@ class VnfCommand @Autowired constructor(
try {
childJobs = pushChildrenJobsToBroker(vfModulesForChildrenJobs(vfModules), dataForChild, JobType.VolumeGroupInstantiation)
} catch (e: AsdcCatalogException) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to retrieve service definitions from SDC, for VfModule is BaseModule.. Error: " + e.message, e)
- //return Job.JobStatus.FAILED
+ LOGGER.error("Failed to retrieve service definitions from SDC, for VfModule is BaseModule.. Error: " + e.message, e)
throw e;
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializer.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializer.java
index 114c20105..981bdeaa7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializer.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializer.java
@@ -64,7 +64,7 @@ public class DeleteOldJobsSchedulerInitializer {
Trigger deleteOldJobsTrigger = createTrigger();
schedulerFactoryBean.getScheduler().scheduleJob(jobDetail, deleteOldJobsTrigger);
} catch (SchedulerException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Failed to schedule trigger for delete old jobs: {}", e.getMessage());
+ logger.error("Failed to schedule trigger for delete old jobs: {}", e.getMessage());
throw new GenericUncheckedException(e);
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSchedulerInitializer.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSchedulerInitializer.java
index b5c2dd74b..bd82ffa7a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSchedulerInitializer.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSchedulerInitializer.java
@@ -20,24 +20,29 @@
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 {
@@ -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);
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java
index c629a665c..c0e006e22 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java
@@ -69,7 +69,7 @@ public class JobWorker extends QuartzJobBean {
try {
return jobsBrokerService.pull(topic, UUID.randomUUID().toString());
} catch (Exception e) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to pull job from queue, breaking: {}", e, e);
+ LOGGER.error("failed to pull job from queue, breaking: {}", e, e);
tryMutingJobFromException(e);
return Optional.empty();
@@ -80,7 +80,7 @@ public class JobWorker extends QuartzJobBean {
try {
jobsBrokerService.pushBack(nextJob);
} catch (Exception e) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "failed pushing back job to queue: {}", e, e);
+ LOGGER.error("failed pushing back job to queue: {}", e, e);
}
}
@@ -114,7 +114,7 @@ public class JobWorker extends QuartzJobBean {
final JobCommand jobCommand = jobCommandFactory.toCommand(job);
nextCommand = jobCommand.call();
} catch (Exception e) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "error while executing job from queue: {}", e);
+ LOGGER.error("error while executing job from queue: {}", e, e);
nextCommand = new NextCommand(FAILED);
}
@@ -153,10 +153,10 @@ public class JobWorker extends QuartzJobBean {
LOGGER.info(EELFLoggerDelegate.debugLogger, "muting job: {} ({})", jobException.getJobUuid(), jobException.toString());
final boolean success = jobsBrokerService.mute(jobException.getJobUuid());
if (!success) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to mute job {}", jobException.getJobUuid());
+ LOGGER.error("failed to mute job {}", jobException.getJobUuid());
}
} catch (Exception e1) {
- LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to mute job: {}", e1, e1);
+ LOGGER.error("failed to mute job: {}", e1, e1);
}
}
}