Package ca.uhn.fhir.cache
Class BaseResourceCacheSynchronizer
java.lang.Object
ca.uhn.fhir.cache.BaseResourceCacheSynchronizer
- All Implemented Interfaces:
IResourceChangeListener
public abstract class BaseResourceCacheSynchronizer
extends Object
implements IResourceChangeListener
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
BaseResourceCacheSynchronizer
(String theResourceName) protected
BaseResourceCacheSynchronizer
(String theResourceName, IResourceChangeListenerRegistry theResourceChangeListenerRegistry, DaoRegistry theDaoRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
protected abstract SearchParameterMap
void
handleChange
(IResourceChangeEvent theResourceChangeEvent) void
handleInit
(Collection<org.hl7.fhir.instance.model.api.IIdType> theResourceIds) protected abstract void
handleInit
(List<org.hl7.fhir.instance.model.api.IBaseResource> resourceList) void
This method performs a search in the DB, so use theContextStartedEvent
to ensure that it runs after the database initializervoid
shutdown()
void
start()
void
Read the existing resources from the databaseprotected abstract int
syncResourcesIntoCache
(List<org.hl7.fhir.instance.model.api.IBaseResource> resourceList) void
-
Field Details
-
MAX_RETRIES
- See Also:
-
REFRESH_INTERVAL
- See Also:
-
-
Constructor Details
-
BaseResourceCacheSynchronizer
-
BaseResourceCacheSynchronizer
protected BaseResourceCacheSynchronizer(String theResourceName, IResourceChangeListenerRegistry theResourceChangeListenerRegistry, DaoRegistry theDaoRegistry)
-
-
Method Details
-
registerListener
@EventListener(classes=org.springframework.context.event.ContextRefreshedEvent.class) @Order(310) public void registerListener()This method performs a search in the DB, so use theContextStartedEvent
to ensure that it runs after the database initializer -
unregisterListener
-
syncDatabaseToCache
Read the existing resources from the database -
acquireSemaphoreForUnitTest
- Throws:
InterruptedException
-
doSyncResourcesForUnitTest
-
syncResourcesIntoCache
protected abstract int syncResourcesIntoCache(List<org.hl7.fhir.instance.model.api.IBaseResource> resourceList) -
start
-
shutdown
-
handleInit
- Specified by:
handleInit
in interfaceIResourceChangeListener
-
handleInit
protected abstract void handleInit(List<org.hl7.fhir.instance.model.api.IBaseResource> resourceList) -
handleChange
- Specified by:
handleChange
in interfaceIResourceChangeListener
-
getSearchParameterMap
-