Catch exception when attempting to fetch metadata at startup
Change-Id: I88be96ad4b9ee205f2ca653bfc09f04b636caf93
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java b/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java
index 2ec138f..788619b 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java
@@ -181,13 +181,17 @@
private Versioned<ClusterMetadata> blockForMetadata(String metadataUrl) {
int iterations = 0;
for (;;) {
- Versioned<ClusterMetadata> metadata = fetchMetadata(metadataUrl);
- if (metadata != null) {
- return metadata;
+ try {
+ Versioned<ClusterMetadata> metadata = fetchMetadata(metadataUrl);
+ if (metadata != null) {
+ return metadata;
+ }
+ } catch (Exception e) {
+ log.warn("Exception attempting to access metadata file at {}: {}", metadataUrl, e);
}
try {
- Thread.sleep(Math.min((int) Math.pow(2, ++iterations) * 10, 1000));
+ Thread.sleep((int) Math.pow(2, iterations < 7 ? ++iterations : iterations) * 10);
} catch (InterruptedException e) {
throw Throwables.propagate(e);
}