
Package ca.uhn.fhir.jpa.cache
Class ResourceChangeListenerCache
java.lang.Object
ca.uhn.fhir.jpa.cache.ResourceChangeListenerCache
- All Implemented Interfaces:
IResourceChangeListenerCache
@Component
@Scope("prototype")
public class ResourceChangeListenerCache
extends Object
implements IResourceChangeListenerCache
-
Constructor Summary
ConstructorsConstructorDescriptionResourceChangeListenerCache
(String theResourceName, IResourceChangeListener theResourceChangeListener, SearchParameterMap theSearchParameterMap, long theRemoteRefreshIntervalMs) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Request that a cache be refreshed now, in the current threadboolean
protected boolean
boolean
matches
(org.hl7.fhir.instance.model.api.IBaseResource theResource) If nextRefreshTime is in the past, then update the cache with the current repository contents and notify its listener of any changesvoid
Request that the cache be refreshed at the next convenient time (in a different thread)void
requestRefreshIfWatching
(org.hl7.fhir.instance.model.api.IBaseResource theResource) Refresh the cache if theResource matches our SearchParameterMapsetInitialized
(boolean theInitialized) static void
setNowForUnitTests
(String theTime) void
setResourceChangeListenerCacheRefresher
(IResourceChangeListenerCacheRefresher theResourceChangeListenerCacheRefresher) toString()
-
Constructor Details
-
ResourceChangeListenerCache
public ResourceChangeListenerCache(String theResourceName, IResourceChangeListener theResourceChangeListener, SearchParameterMap theSearchParameterMap, long theRemoteRefreshIntervalMs)
-
-
Method Details
-
requestRefresh
Request that the cache be refreshed at the next convenient time (in a different thread)- Specified by:
requestRefresh
in interfaceIResourceChangeListenerCache
-
forceRefresh
Request that a cache be refreshed now, in the current thread- Specified by:
forceRefresh
in interfaceIResourceChangeListenerCache
- Returns:
- counts of detected resource creates, updates and deletes
-
requestRefreshIfWatching
Refresh the cache if theResource matches our SearchParameterMap- Parameters:
theResource
-
-
matches
-
refreshCacheIfNecessary
Description copied from interface:IResourceChangeListenerCache
If nextRefreshTime is in the past, then update the cache with the current repository contents and notify its listener of any changes- Specified by:
refreshCacheIfNecessary
in interfaceIResourceChangeListenerCache
- Returns:
- counts of detected resource creates, updates and deletes
-
isTimeToRefresh
-
refreshCacheWithRetry
-
setResourceChangeListenerCacheRefresher
public void setResourceChangeListenerCacheRefresher(IResourceChangeListenerCacheRefresher theResourceChangeListenerCacheRefresher) -
getNextRefreshTime
- Specified by:
getNextRefreshTime
in interfaceIResourceChangeListenerCache
- Returns:
- the next scheduled time the cache will search the repository, update its cache and notify its listener of any changes
-
getSearchParameterMap
- Specified by:
getSearchParameterMap
in interfaceIResourceChangeListenerCache
- Returns:
- the search parameter map the listener was registered with
-
isInitialized
- Specified by:
isInitialized
in interfaceIResourceChangeListenerCache
- Returns:
- whether the cache has been initialized. (If not, the cache will be empty.)
-
setInitialized
-
getResourceName
- Specified by:
getResourceName
in interfaceIResourceChangeListenerCache
- Returns:
- the name of the resource type the listener was registered with
-
getResourceVersionCache
-
getResourceChangeListener
-
setNowForUnitTests
- Parameters:
theTime
- has format like "12:34:56" i.e. HH:MM:SS
-
clearForUnitTest
-
toString
-