
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>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSearchCoordinatorSvcImpl(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, IRequestPartitionHelperSvc theRequestPartitionHelperSvc) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidgetResources(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.IBundleProviderregisterSearch(IFhirResourceDao<?> theCallingDao, SearchParameterMap theParams, String theResourceType, ca.uhn.fhir.rest.api.CacheControlDirective theCacheControlDirective, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) voidsetIdToSearchTaskMapForUnitTests(ConcurrentHashMap<String, SearchTask> theIdToSearchTaskMap) voidsetLoadingThrottleForUnitTests(Integer theLoadingThrottleForUnitTests) voidsetMaxMillisToWaitForRemoteResultsForUnitTest(long theMaxMillisToWaitForRemoteResults) voidsetNeverUseLocalSearchForUnitTests(boolean theNeverUseLocalSearchForUnitTests) voidsetSyncSizeForUnitTests(int theSyncSize) static org.springframework.data.domain.PageabletoPage(int theFromIndex, int theToIndex) Creates aPageableusing a start and end index
-
Field Details
-
SEARCH_EXPIRY_OFFSET_MINUTES
- See Also:
-
-
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, IRequestPartitionHelperSvc theRequestPartitionHelperSvc) Constructor
-
-
Method Details
-
setIdToSearchTaskMapForUnitTests
public void setIdToSearchTaskMapForUnitTests(ConcurrentHashMap<String, SearchTask> theIdToSearchTaskMap) -
setLoadingThrottleForUnitTests
-
setNeverUseLocalSearchForUnitTests
-
setSyncSizeForUnitTests
-
cancelAllActiveSearches
- Specified by:
cancelAllActiveSearchesin interfaceISearchCoordinatorSvc<JpaPid>
-
setMaxMillisToWaitForRemoteResultsForUnitTest
-
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
Searchentity 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 conflicts. The other thread just needs to wait until the first one actually fetches more results.- Specified by:
getResourcesin 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, @Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) - Specified by:
registerSearchin interfaceISearchCoordinatorSvc<JpaPid>
-
getSearchTotal
public Optional<Integer> getSearchTotal(String theUuid, @Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId) - Specified by:
getSearchTotalin interfaceISearchCoordinatorSvc<JpaPid>
-
toPage
@Nullable public static org.springframework.data.domain.Pageable toPage(int theFromIndex, int theToIndex) Creates aPageableusing a start and end index
-