Sonar Fix: CronJobManager.java
[music.git] / src / main / java / org / onap / music / main / MusicUtil.java
index 2dd2f23..cfad845 100755 (executable)
@@ -86,6 +86,8 @@ public class MusicUtil {
     private static String myCassaHost = LOCALHOST;
     private static String defaultMusicIp = LOCALHOST;
     private static int cassandraPort = 9042;
+    private static int notifytimeout = 30000;
+    private static int notifyinterval = 5000;
     
     private static boolean debug = true;
     private static String version = "2.3.0";
@@ -94,12 +96,12 @@ public class MusicUtil {
     private static long defaultLockLeasePeriod = 6000;
     private static final String[] propKeys = new String[] { "zookeeper.host", "cassandra.host", "music.ip", "debug",
             "version", "music.rest.ip", "music.properties", "lock.lease.period", "id", "all.ids", "public.ip",
-            "all.pubic.ips", "cassandra.user", "cassandra.password", "aaf.endpoint.url","cassandra.port" };
+            "all.pubic.ips", "cassandra.user", "cassandra.password", "aaf.endpoint.url","cassandra.port", "notify.timeout", "notify.interval" };
 
     private static String cassName = "cassandra";
     private static String cassPwd;
     private static String aafEndpointUrl = null;
-    public static ConcurrentMap<String, Long> zkNodeMap = new ConcurrentHashMap<>();
+    public static final ConcurrentMap<String, Long> zkNodeMap = new ConcurrentHashMap<>();
 
     private MusicUtil() {
         throw new IllegalStateException("Utility Class");
@@ -597,7 +599,7 @@ public class MusicUtil {
                    try {
                        input.close();
                    } catch (IOException e) {
-                       e.printStackTrace();
+                       logger.error(EELFLoggerDelegate.applicationLogger,"Load properties failed "+e.getMessage(),e);
                    }
                }
            }
@@ -608,7 +610,24 @@ public class MusicUtil {
                MusicUtil.setCassName(prop.getProperty("cassandra.user"));
                MusicUtil.setCassPwd(prop.getProperty("cassandra.password"));
                MusicUtil.setCassandraPort(Integer.parseInt(prop.getProperty("cassandra.port")));
+               MusicUtil.setNotifyTimeOut(Integer.parseInt(prop.getProperty("notify.timeout")));
+               MusicUtil.setNotifyInterval(Integer.parseInt(prop.getProperty("notify.interval")));
                
        }
+    
+       public static void setNotifyInterval(int notifyinterval) {
+               MusicUtil.notifyinterval = notifyinterval;
+       }
+       public static void setNotifyTimeOut(int notifytimeout) {
+               MusicUtil.notifytimeout = notifytimeout;
+       }
 
+       public static int getNotifyInterval() {
+               return MusicUtil.notifyinterval;
+       }
+       
+       public static int getNotifyTimeout() {
+               return MusicUtil.notifytimeout;
+               
+       }
 }