Running Dmaap consumer in a seprate thread
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / tasks / RefreshConfigTask.java
index 1ab5fc9..f5834e3 100644 (file)
@@ -81,9 +81,9 @@ public class RefreshConfigTask {
         stop();
         loadConfigurationFromFile();
         refreshTask = createRefreshTask() //
-            .subscribe(notUsed -> logger.info("Refreshed configuration data"),
+            .subscribe(notUsed -> logger.debug("Refreshed configuration data"),
                 throwable -> logger.error("Configuration refresh terminated due to exception", throwable),
-                () -> logger.error("Configuration refresh terminated"));
+                () -> logger.debug("Configuration refresh completed"));
     }
 
     public void stop() {
@@ -146,8 +146,7 @@ public class RefreshConfigTask {
         ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
 
         try (InputStream inputStream = createInputStream(filepath)) {
-            JsonParser parser = new JsonParser();
-            JsonObject rootObject = getJsonElement(parser, inputStream).getAsJsonObject();
+            JsonObject rootObject = getJsonElement(inputStream).getAsJsonObject();
             if (rootObject == null) {
                 throw new JsonSyntaxException("Root is not a json object");
             }
@@ -161,8 +160,8 @@ public class RefreshConfigTask {
         }
     }
 
-    JsonElement getJsonElement(JsonParser parser, InputStream inputStream) {
-        return parser.parse(new InputStreamReader(inputStream));
+    JsonElement getJsonElement(InputStream inputStream) {
+        return JsonParser.parseReader(new InputStreamReader(inputStream));
     }
 
     InputStream createInputStream(@NotNull String filepath) throws IOException {