Add a retry to database expunge routines

This commit is contained in:
James Agnew 2018-09-11 07:59:11 -04:00
parent 0e75c8ed39
commit 94eb12aca3
4 changed files with 18 additions and 5 deletions

View File

@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.text.WordUtils;
import org.apache.commons.text.WordUtils;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;

View File

@ -38,7 +38,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.text.WordUtils;
import org.apache.commons.text.WordUtils;
import org.hl7.fhir.instance.model.api.*;
import java.io.IOException;

View File

@ -27,7 +27,7 @@ import ca.uhn.fhir.util.jar.DependencyLogFactory;
import ca.uhn.fhir.util.jar.IDependencyLog;
import com.ctc.wstx.api.WstxInputProperties;
import com.ctc.wstx.stax.WstxOutputFactory;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.codehaus.stax2.XMLOutputFactory2;
import org.codehaus.stax2.io.EscapingWriterFactory;
@ -54,7 +54,7 @@ public class XmlUtil {
private static volatile XMLOutputFactory ourOutputFactory;
static {
HashMap<String, Integer> validEntityNames = new HashMap<String, Integer>(1448);
HashMap<String, Integer> validEntityNames = new HashMap<>(1448);
validEntityNames.put("AElig", 0x000C6);
validEntityNames.put("Aacute", 0x000C1);
validEntityNames.put("Abreve", 0x00102);

View File

@ -335,7 +335,20 @@ public abstract class BaseJpaTest {
boolean expungeEnabled = theDaoConfig.isExpungeEnabled();
theDaoConfig.setExpungeEnabled(true);
theSystemDao.expunge(new ExpungeOptions().setExpungeEverything(true));
for (int count = 0;; count++) {
try {
theSystemDao.expunge(new ExpungeOptions().setExpungeEverything(true));
break;
} catch (Exception e) {
if (count >= 3) {
ourLog.error("Failed during expunge", e);
fail(e.toString());
} else {
Thread.sleep(1000);
}
}
}
theDaoConfig.setExpungeEnabled(expungeEnabled);
theSearchParamRegistry.forceRefresh();