Skip to content
Snippets Groups Projects
Commit 03d3b076 authored by felmer's avatar felmer
Browse files

Try several times if dropping of database for indexing fails.

SVN: 28341
parent 3a16d2ac
No related branches found
No related tags found
No related merge requests found
...@@ -110,11 +110,30 @@ public class TestInitializer ...@@ -110,11 +110,30 @@ public class TestInitializer
String databaseName = "openbis_" + databaseKind; String databaseName = "openbis_" + databaseKind;
String sql = "drop database if exists " + databaseName; String sql = "drop database if exists " + databaseName;
List<String> cmd = Arrays.asList(psql, "-U", "postgres", "-c", sql); List<String> cmd = Arrays.asList(psql, "-U", "postgres", "-c", sql);
boolean result = ProcessExecutionHelper.runAndLog(cmd, operationLog, operationLog); for (int i = 0, n = 10; i < n; i++)
if (result == false)
{ {
operationLog.error("Couldn't drop database created for indexing: " boolean result =
+ databaseName); ProcessExecutionHelper.runAndLog(cmd, operationLog, operationLog);
if (result == false)
{
operationLog.error("Couldn't drop database created for indexing: "
+ databaseName);
if (i < n - 1)
{
operationLog.info("Try it again after some waiting time");
try
{
Thread.sleep(2000);
} catch (InterruptedException ex)
{
// ignored silently
}
}
} else
{
operationLog.info("Database for indexing ropped: " + databaseName);
break;
}
} }
} }
firstTry = false; firstTry = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment