diff options
author | 2018-10-31 15:50:33 -0400 | |
---|---|---|
committer | 2018-10-31 15:50:33 -0400 | |
commit | dfa695ebe1cfac0e7f28b4bd6fe895070ce8c794 (patch) | |
tree | ce7397eaae8b00abd32435dc3682ea606b2f29d6 | |
parent | ba7663c109b6bbfbaa97cc3286c5d1cae1b1c4dc (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.java | 18 |
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); |