summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/dcae/RestConfCollector.java9
-rwxr-xr-xsrc/main/java/org/onap/dcae/common/DataChangeEventListener.java1
-rw-r--r--src/main/java/org/onap/dcae/controller/AccessController.java10
-rw-r--r--src/main/java/org/onap/dcae/controller/PersistentEventConnection.java19
4 files changed, 35 insertions, 4 deletions
diff --git a/src/main/java/org/onap/dcae/RestConfCollector.java b/src/main/java/org/onap/dcae/RestConfCollector.java
index 05c299e..545bfd4 100644
--- a/src/main/java/org/onap/dcae/RestConfCollector.java
+++ b/src/main/java/org/onap/dcae/RestConfCollector.java
@@ -78,8 +78,8 @@ public class RestConfCollector {
init();
app.setAddCommandLineProperties(true);
context = app.run();
- configLoader.updateConfig();
controllerConfig(properties);
+ configLoader.updateConfig();
oplog.info("RestConfController running .....");
}
@@ -153,6 +153,13 @@ public class RestConfCollector {
}
private static void controllerConfigCleanup() {
+ log.info("controller ConfigCleanup!");
+ for (java.util.Map.Entry<String, AccessController> entry : controllerStore.entrySet()) {
+ AccessController acstlr = entry.getValue();
+ log.info("controller detail " + acstlr.getCfgInfo().getController_restapiUrl());
+ acstlr.clearAllPersistentConnectios();
+ controllerStore.remove(acstlr);
+ }
controllerStore.clear();
}
diff --git a/src/main/java/org/onap/dcae/common/DataChangeEventListener.java b/src/main/java/org/onap/dcae/common/DataChangeEventListener.java
index 2492c21..6cf2291 100755
--- a/src/main/java/org/onap/dcae/common/DataChangeEventListener.java
+++ b/src/main/java/org/onap/dcae/common/DataChangeEventListener.java
@@ -41,7 +41,6 @@ public class DataChangeEventListener implements EventListener {
@Override
public void onEvent(InboundEvent event) {
try {
- log.info("SSE Event is received");
String s = event.readData();
jsonType type = isJSONValid(s);
if (type == jsonType.OBJECT) {
diff --git a/src/main/java/org/onap/dcae/controller/AccessController.java b/src/main/java/org/onap/dcae/controller/AccessController.java
index daf6237..5050b4b 100644
--- a/src/main/java/org/onap/dcae/controller/AccessController.java
+++ b/src/main/java/org/onap/dcae/controller/AccessController.java
@@ -294,4 +294,14 @@ public class AccessController {
fetchTokenId();
}
}
+
+ public void clearAllPersistentConnectios() {
+ log.info("clearAll PersistentConnectios !");
+ for (java.util.Map.Entry<String, PersistentEventConnection> entry : eventList.entrySet()) {
+ PersistentEventConnection conn = entry.getValue();
+ conn.shutdown();
+ }
+ accesstokenRenewal.cancel(true);
+ scheduledThreadPoolExecutor.shutdown();
+ }
}
diff --git a/src/main/java/org/onap/dcae/controller/PersistentEventConnection.java b/src/main/java/org/onap/dcae/controller/PersistentEventConnection.java
index 14eb2e3..ecbec31 100644
--- a/src/main/java/org/onap/dcae/controller/PersistentEventConnection.java
+++ b/src/main/java/org/onap/dcae/controller/PersistentEventConnection.java
@@ -193,7 +193,6 @@ public class PersistentEventConnection implements Runnable {
openState = eventSrc.isOpen();
log.info("SSE state " + eventSrc.isOpen());
}
- log.info("SSE state " + openState);
if (eventSrc != null && !openState)
{
log.info("SSE state " + eventSrc.isOpen() + " Resubscribing after 1 minute...");
@@ -201,10 +200,15 @@ public class PersistentEventConnection implements Runnable {
/* Resubscribe again */
subscribe = true;
}
+ } catch (InterruptedException ie) {
+ log.info("Exception: " + ie.getMessage());
+ running = false;
+ eventSrc.close();
+ Thread.currentThread().interrupt();
+ return;
} catch (Exception e){
/* Other exception we can keep on retrying */
log.info("Connection failed: " + e.getMessage());
- running = true;
subscribe = true;
if (eventSrc != null) {
eventSrc.close();
@@ -212,6 +216,13 @@ public class PersistentEventConnection implements Runnable {
}
}
}
+ try {
+ if (eventSrc.isOpen()) {
+ eventSrc.close();
+ }
+ }catch (Exception e) {
+ log.info("Connection close failed: " + e.getMessage());
+ }
log.info("Closed connection to SSE source");
}
@@ -349,4 +360,8 @@ public class PersistentEventConnection implements Runnable {
public RestConfContext getCtx() {
return ctx;
}
+
+ public void shutdown() {
+ running = false;
+ }
}