small performance optimization (#3426)
This commit is contained in:
parent
c9b87d7c67
commit
c7be674b84
|
@ -194,7 +194,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
|
||||||
public static final long INDEX_STATUS_INDEXING_FAILED = 2L;
|
public static final long INDEX_STATUS_INDEXING_FAILED = 2L;
|
||||||
public static final String NS_JPA_PROFILE = "https://github.com/hapifhir/hapi-fhir/ns/jpa/profile";
|
public static final String NS_JPA_PROFILE = "https://github.com/hapifhir/hapi-fhir/ns/jpa/profile";
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(BaseHapiFhirDao.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(BaseHapiFhirDao.class);
|
||||||
private static final Map<FhirVersionEnum, FhirContext> ourRetrievalContexts = new HashMap<>();
|
|
||||||
private static boolean ourValidationDisabledForUnitTest;
|
private static boolean ourValidationDisabledForUnitTest;
|
||||||
private static boolean ourDisableIncrementOnUpdateForUnitTest = false;
|
private static boolean ourDisableIncrementOnUpdateForUnitTest = false;
|
||||||
|
|
||||||
|
@ -391,14 +390,10 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
|
||||||
|
|
||||||
public FhirContext getContext(FhirVersionEnum theVersion) {
|
public FhirContext getContext(FhirVersionEnum theVersion) {
|
||||||
Validate.notNull(theVersion, "theVersion must not be null");
|
Validate.notNull(theVersion, "theVersion must not be null");
|
||||||
synchronized (ourRetrievalContexts) {
|
if (theVersion == myFhirContext.getVersion().getVersion()) {
|
||||||
FhirContext retVal = ourRetrievalContexts.get(theVersion);
|
return myFhirContext;
|
||||||
if (retVal == null) {
|
|
||||||
retVal = new FhirContext(theVersion);
|
|
||||||
ourRetrievalContexts.put(theVersion, retVal);
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
return FhirContext.forCached(theVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -434,7 +429,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
|
||||||
/**
|
/**
|
||||||
* Gets the tag defined by the fed in values, or saves it if it does not
|
* Gets the tag defined by the fed in values, or saves it if it does not
|
||||||
* exist.
|
* exist.
|
||||||
*
|
* <p>
|
||||||
* Can also throw an InternalErrorException if something bad happens.
|
* Can also throw an InternalErrorException if something bad happens.
|
||||||
*/
|
*/
|
||||||
private TagDefinition getOrCreateTag(TagTypeEnum theTagType, String theScheme, String theTerm, String theLabel) {
|
private TagDefinition getOrCreateTag(TagTypeEnum theTagType, String theScheme, String theTerm, String theLabel) {
|
||||||
|
|
Loading…
Reference in New Issue