aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index ecffb683ca..fe166f7942 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -24,15 +24,13 @@ package org.onap.so.asdc;
import java.security.SecureRandom;
import javax.annotation.PreDestroy;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
-import org.onap.so.logger.ErrorCode;
-import org.onap.so.logger.ScheduledTasksMDCSetup;
-import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.logging.filter.base.ScheduledLogging;
+import org.onap.logging.filter.base.ScheduledTaskException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
@@ -47,16 +45,13 @@ public class ASDCControllerSingleton {
private final ASDCController asdcController;
@Autowired
- private ScheduledTasksMDCSetup scheduledMDCSetup;
-
- @Autowired
public ASDCControllerSingleton(final ASDCController asdcController) {
this.asdcController = asdcController;
}
+ @ScheduledLogging
@Scheduled(fixedRate = 50000)
- public void periodicControllerTask() {
- scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask");
+ public void periodicControllerTask() throws ScheduledTaskException {
try {
final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
asdcController.setControllerName("mso-controller" + randomNumber);
@@ -66,11 +61,9 @@ public class ASDCControllerSingleton {
asdcController.initASDC();
}
} catch (final ASDCControllerException controllerException) {
- scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.error("Exception occurred", controllerException);
+ throw new ScheduledTaskException(ErrorCode.UnknownError, controllerException.getMessage(),
+ controllerException);
}
- scheduledMDCSetup.exitAndClearMDC();
}
@PreDestroy