Migrate ccsdk/apps to ccsdk/cds
[so.git] / asdc-controller / src / main / java / org / onap / so / asdc / ASDCControllerSingleton.java
index 62971ec..9e75c7c 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -22,14 +24,14 @@ package org.onap.so.asdc;
 
 import javax.annotation.PreDestroy;
 
-import org.onap.so.asdc.client.ASDCConfiguration;
 import org.onap.so.asdc.client.ASDCController;
 import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Profile;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
-import org.onap.so.logger.MsoLogger;
 import java.security.SecureRandom;
 
 
@@ -40,30 +42,28 @@ public class ASDCControllerSingleton {
    
     @Autowired
     private ASDCController asdcController;
-    private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC, ASDCControllerSingleton.class);
+    private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
   
 
 
     @Scheduled (fixedRate = 50000)
        public void periodicControllerTask() {
-       
-               try {
-            int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
-                       asdcController.setControllerName("mso-controller"+randomNumber);
-                       asdcController.initASDC();
-               } catch (ASDCControllerException e) {
-                       msoLogger.error(e);
-       
-               }
+                       try {
+                               int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
+                               asdcController.setControllerName("mso-controller" + randomNumber);
+                               asdcController.initASDC();
+                       } catch (ASDCControllerException e) {
+                               logger.error("Exception occurred", e);
+                       }
        }
    
    @PreDestroy
    private void terminate () {
-          try {
-               asdcController.closeASDC ();
-       } catch (ASDCControllerException e) {
-               msoLogger.error(e);
-       }
-   }
+                try {
+                        asdcController.closeASDC();
+                } catch (ASDCControllerException e) {
+                        logger.error("Exception occurred", e);
+                }
+        }
 
 }