Package ca.uhn.fhir.jpa.search
Class SearchCoordinatorSvcImpl
java.lang.Object
ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl
- All Implemented Interfaces:
ISearchCoordinatorSvc<JpaPid>
@Component("mySearchCoordinatorSvc")
public class SearchCoordinatorSvcImpl
extends Object
implements ISearchCoordinatorSvc<JpaPid>
-
Constructor Summary
ConstructorDescriptionSearchCoordinatorSvcImpl
(ca.uhn.fhir.context.FhirContext theContext, JpaStorageSettings theStorageSettings, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, HapiTransactionService theTxService, ISearchCacheSvc theSearchCacheSvc, ISearchResultCacheSvc theSearchResultCacheSvc, DaoRegistry theDaoRegistry, SearchBuilderFactory<JpaPid> theSearchBuilderFactory, ISynchronousSearchSvc theSynchronousSearchSvc, PersistedJpaBundleProviderFactory thePersistedJpaBundleProviderFactory, ca.uhn.fhir.rest.server.util.ISearchParamRegistry theSearchParamRegistry, SearchStrategyFactory theSearchStrategyFactory, ExceptionService theExceptionSvc, org.springframework.beans.factory.BeanFactory theBeanFactory) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
getResources
(String theUuid, int theFrom, int theTo, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) This method is called by the HTTP client processing thread in order to fetch resources.getSearchTotal
(String theUuid, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) ca.uhn.fhir.rest.api.server.IBundleProvider
registerSearch
(IFhirResourceDao<?> theCallingDao, SearchParameterMap theParams, String theResourceType, ca.uhn.fhir.rest.api.CacheControlDirective theCacheControlDirective, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) void
setIdToSearchTaskMapForUnitTests
(ConcurrentHashMap<String, SearchTask> theIdToSearchTaskMap) void
setLoadingThrottleForUnitTests
(Integer theLoadingThrottleForUnitTests) void
setNeverUseLocalSearchForUnitTests
(boolean theNeverUseLocalSearchForUnitTests) void
setSyncSizeForUnitTests
(int theSyncSize) static org.springframework.data.domain.Pageable
toPage
(int theFromIndex, int theToIndex) Creates aPageable
using a start and end index
-
Constructor Details
-
SearchCoordinatorSvcImpl
public SearchCoordinatorSvcImpl(ca.uhn.fhir.context.FhirContext theContext, JpaStorageSettings theStorageSettings, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, HapiTransactionService theTxService, ISearchCacheSvc theSearchCacheSvc, ISearchResultCacheSvc theSearchResultCacheSvc, DaoRegistry theDaoRegistry, SearchBuilderFactory<JpaPid> theSearchBuilderFactory, ISynchronousSearchSvc theSynchronousSearchSvc, PersistedJpaBundleProviderFactory thePersistedJpaBundleProviderFactory, ca.uhn.fhir.rest.server.util.ISearchParamRegistry theSearchParamRegistry, SearchStrategyFactory theSearchStrategyFactory, ExceptionService theExceptionSvc, org.springframework.beans.factory.BeanFactory theBeanFactory) Constructor
-
-
Method Details
-
setIdToSearchTaskMapForUnitTests
public void setIdToSearchTaskMapForUnitTests(ConcurrentHashMap<String, SearchTask> theIdToSearchTaskMap) -
setLoadingThrottleForUnitTests
-
setNeverUseLocalSearchForUnitTests
-
setSyncSizeForUnitTests
-
cancelAllActiveSearches
- Specified by:
cancelAllActiveSearches
in interfaceISearchCoordinatorSvc<JpaPid>
-
getResources
public List<JpaPid> getResources(String theUuid, int theFrom, int theTo, @Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) This method is called by the HTTP client processing thread in order to fetch resources.This method must not be called from inside a transaction. The rationale is that the
Search
entity is treated as a piece of shared state across client threads accessing the same thread, so we need to be able to update that table in a transaction and commit it right away in order for that to work. Examples of needing to do this include if two different clients request the same search and are both paging at the same time, but also includes clients that are hacking the paging links to fetch multiple pages of a search result in parallel. In both cases we need to only let one of them actually activate the search, or we will have conficts. The other thread just needs to wait until the first one actually fetches more results.- Specified by:
getResources
in interfaceISearchCoordinatorSvc<JpaPid>
-
registerSearch
public ca.uhn.fhir.rest.api.server.IBundleProvider registerSearch(IFhirResourceDao<?> theCallingDao, SearchParameterMap theParams, String theResourceType, ca.uhn.fhir.rest.api.CacheControlDirective theCacheControlDirective, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) - Specified by:
registerSearch
in interfaceISearchCoordinatorSvc<JpaPid>
-
getSearchTotal
public Optional<Integer> getSearchTotal(String theUuid, @Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) - Specified by:
getSearchTotal
in interfaceISearchCoordinatorSvc<JpaPid>
-
toPage
@Nullable public static org.springframework.data.domain.Pageable toPage(int theFromIndex, int theToIndex) Creates aPageable
using a start and end index
-