aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dtimoney@att.com>2018-10-31 15:50:33 -0400
committerDan Timoney <dtimoney@att.com>2018-10-31 20:13:28 +0000
commit25bb156451b5603f53f3db125c7876a7de571bd8 (patch)
treef9731bbe39595147cb7c63117b18c34ba7222012
parentf5238afed0d9b0e3a01af5d71b3471bed6953c42 (diff)
Fix error handling
Recreate client objects after failure is returned by SDC before retrying. Change-Id: Ib165fc1220a010a0443a7dab4014aaba8c9f29f8 Issue-ID: SDNC-472 Signed-off-by: Timoney, Dan (dt5972) <dtimoney@att.com>
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java
index c025f3b0..4f2de1cc 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java
@@ -34,13 +34,12 @@ public class SdncUebClient {
private static final Logger LOG = LoggerFactory.getLogger(SdncUebConfiguration.class);
public static void main(String[] args) {
- IDistributionClient client = DistributionClientFactory.createDistributionClient();
SdncUebConfiguration config = new SdncUebConfiguration();
+ IDistributionClient client = DistributionClientFactory.createDistributionClient();
SdncUebCallback cb = new SdncUebCallback(client, config);
-
LOG.info("Scanning for local distribution artifacts before starting client");
cb.deployDownloadedFiles(null, null, null);
@@ -67,6 +66,21 @@ public class SdncUebClient {
if (start.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
keepWaiting = false;
+ } else {
+ LOG.info("SDC returned "+start.getDistributionActionResult().toString()+" - will retry");
+ try {
+ client.stop();
+ } catch(Exception e1) {
+ // Ignore exception on stop
+ }
+ client = DistributionClientFactory.createDistributionClient();
+ cb = new SdncUebCallback(client, config);
+ LOG.info("Initializing ASDC distribution client");
+
+ result = client.init(config, cb);
+
+ LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult());
+
}
} catch(Exception e) {
LOG.info("Client startup failure", e);