Class SearchTask
java.lang.Object
ca.uhn.fhir.jpa.search.builder.tasks.SearchTask
- Direct Known Subclasses:
SearchContinuationTask
A search task is a Callable task that runs in
a thread pool to handle an individual search. One instance
is created for any requested search and runs from the
beginning to the end of the search.
Understand: This class executes in its own thread separate from the web server client thread that made the request. We do that so that we can return to the client as soon as possible, but keep the search going in the background (and have the next page of results ready to go when the client asks).
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ca.uhn.fhir.context.FhirContext
protected final ISearchResultCacheSvc
protected final HapiTransactionService
-
Constructor Summary
ConstructorDescriptionSearchTask
(SearchTaskParameters theCreationParams, HapiTransactionService theManagedTxManager, ca.uhn.fhir.context.FhirContext theContext, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, SearchBuilderFactory theSearchBuilderFactory, ISearchResultCacheSvc theSearchResultCacheSvc, JpaStorageSettings theStorageSettings, ISearchCacheSvc theSearchCacheSvc, ca.uhn.fhir.rest.server.IPagingProvider thePagingProvider) Constructor -
Method Summary
Modifier and TypeMethodDescriptionThis method is called by the server HTTP thread, and will block until at least one page of results have been fetched from the DB, and will never block after that.call()
This is the method which actually performs the search.protected RequestPartitionId
getResourcePids
(int theFromIndex, int theToIndex) boolean
void
void
Request that the task abort as soon as possiblevoid
void
setPreviouslyAddedResourcePids
(List<JpaPid> thePreviouslyAddedResourcePids)
-
Field Details
-
myTxService
-
myContext
-
mySearchResultCacheSvc
-
-
Constructor Details
-
SearchTask
public SearchTask(SearchTaskParameters theCreationParams, HapiTransactionService theManagedTxManager, ca.uhn.fhir.context.FhirContext theContext, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, SearchBuilderFactory theSearchBuilderFactory, ISearchResultCacheSvc theSearchResultCacheSvc, JpaStorageSettings theStorageSettings, ISearchCacheSvc theSearchCacheSvc, ca.uhn.fhir.rest.server.IPagingProvider thePagingProvider) Constructor
-
-
Method Details
-
getRequestPartitionId
-
awaitInitialSync
This method is called by the server HTTP thread, and will block until at least one page of results have been fetched from the DB, and will never block after that. -
getSearch
-
getInitialCollectionLatch
-
setPreviouslyAddedResourcePids
-
getResourcePids
-
saveSearch
-
isNotAborted
-
markComplete
-
getCompletionLatch
-
requestImmediateAbort
Request that the task abort as soon as possible -
call
This is the method which actually performs the search. It is called automatically by the thread pool.
-