From 35f4a305073fd201e015246081fe60eaffd00fd3 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Fri, 1 Feb 2019 18:28:08 -0500 Subject: add in a retry function for cloud config migration add in a retry function into cloud config migration Change-Id: Iee5dd2ece0262cc7087021b567d9661e0ef91d72 Issue-ID: SO-1457 Signed-off-by: Benjamin, Max (mb388a) --- .../main/java/db/migration/R__CloudConfigMigration.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'adapters/mso-openstack-adapters/src') diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java index 257ad3c023..5acd8359ec 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -65,7 +65,22 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro LOGGER.debug("Starting migration for CloudConfig"); CloudConfig cloudConfig = null; - + + String tableQuery = "SELECT * FROM identity_services"; + int totalRetries = 20; + boolean tableExists = false; + int count = 1; + while(!tableExists && count != totalRetries) { + try(Statement stmt = connection.createStatement();) { + stmt.executeQuery(tableQuery); + tableExists = true; + } catch (SQLException e) { + count++; + // Wait 5 mintues + Thread.sleep(300000); + } + } + // Try the override file String configLocation = System.getProperty("spring.config.additional-location"); if (configLocation != null) { -- cgit 1.2.3-korg