From 03de237846d1e10f21eec8239b59073e738b25c0 Mon Sep 17 00:00:00 2001 From: gitseti Date: Thu, 18 Feb 2021 11:53:13 +0100 Subject: [PATCH] Use last valid config in case of failed reload --- .../discovery/azure/client/AzureStorageClient.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hivemq/extensions/discovery/azure/client/AzureStorageClient.java b/src/main/java/com/hivemq/extensions/discovery/azure/client/AzureStorageClient.java index 6002ece..7208deb 100644 --- a/src/main/java/com/hivemq/extensions/discovery/azure/client/AzureStorageClient.java +++ b/src/main/java/com/hivemq/extensions/discovery/azure/client/AzureStorageClient.java @@ -55,9 +55,16 @@ public void createOrUpdate() throws IllegalStateException, IllegalArgumentExcept final AzureDiscoveryConfig newAzureDiscoveryConfig = configReader.readConfiguration(); if (newAzureDiscoveryConfig == null) { - throw new IllegalStateException("Configuration of the Azure Cluster Discovery Extension couldn't be loaded."); + if (azureDiscoveryConfig != null) { + log.warn("Configuration of the Azure Cluster Discovery Extension couldn't be loaded. Using last valid configuration."); + } + else { + throw new IllegalStateException("Configuration of the Azure Cluster Discovery Extension couldn't be loaded."); + } + } + else { + azureDiscoveryConfig = newAzureDiscoveryConfig; } - azureDiscoveryConfig = newAzureDiscoveryConfig; final String connectionString = azureDiscoveryConfig.getConnectionString(); final String containerName = azureDiscoveryConfig.getContainerName();