Set error cacheing via system property

This commit is contained in:
dotasek 2021-12-13 12:57:37 -05:00
parent 3b58aef820
commit 11503115df
3 changed files with 12 additions and 4 deletions

View File

@ -899,7 +899,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
if (code.hasSystem()) {
codeSystemsUsed.add(code.getSystem());
}
CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null;
final CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null;
ValidationResult res = null;
if (txCache != null) {
res = txCache.getValidation(cacheToken);
@ -948,14 +948,15 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
if (options.isGuessSystem()) {
pIn.addParameter().setName("implySystem").setValue(new BooleanType(true));
}
setTerminologyOptions(options, pIn);res = validateOnServer(vs, pIn, options);
setTerminologyOptions(options, pIn);
res = validateOnServer(vs, pIn, options);
} catch (Exception e) {
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
}
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && !code.hasVersion()) {
unsupportedCodeSystems.add(codeKey);
}
if (txCache != null) { // we never cache unsuppoted code systems - we always keep trying (but only once per run)
if (txCache != null) { // we never cache unsupported code systems - we always keep trying (but only once per run)
txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT);
}
return res;

View File

@ -126,7 +126,8 @@ public class TerminologyCache {
static {
String cacheErrorsProperty = System.getProperty("cacheErrors");
cacheErrors = true;//cacheErrorsProperty != null ? "TRUE".equals(cacheErrorsProperty.toUpperCase(Locale.ROOT)) : false;
cacheErrors = cacheErrorsProperty != null ? "TRUE".equals(cacheErrorsProperty.toUpperCase(Locale.ROOT)) : false;
System.out.println();
}
// use lock from the context

View File

@ -377,6 +377,9 @@
<excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes>
<systemPropertyVariables>
<cacheErrors>TRUE</cacheErrors>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
@ -406,6 +409,9 @@
<excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes>
<systemPropertyVariables>
<cacheErrors>TRUE</cacheErrors>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>