Package com.ibm.fhir.bucket.scanner
Class ResourceHandler
- java.lang.Object
-
- com.ibm.fhir.bucket.scanner.ResourceHandler
-
public class ResourceHandler extends Object
Calls the FHIR REST API to create resources, supported by a thread pool
-
-
Constructor Summary
Constructors Constructor Description ResourceHandler(ExecutorService commonPool, int maxConcurrentFhirRequests, FhirClient fc, DataAccess dataAccess)Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit()booleanprocess(ResourceEntry entry)Add the resource entry to the thread-pool for processing, subject to the rate limiting we have to make sure memory consumption is kept in checkprotected voidprocessBadRequest(ResourceEntry re, FhirServerResponse response)Record the error in the databasevoidprocessThr(ResourceEntry re)Process the resource in the thread poolvoidsignalStop()Tell the ResourceHandler to shut down processingvoidwaitForStop()Shut down all resource processing
-
-
-
Constructor Detail
-
ResourceHandler
public ResourceHandler(ExecutorService commonPool, int maxConcurrentFhirRequests, FhirClient fc, DataAccess dataAccess)
Public constructor- Parameters:
poolSize-
-
-
Method Detail
-
signalStop
public void signalStop()
Tell the ResourceHandler to shut down processing
-
waitForStop
public void waitForStop()
Shut down all resource processing
-
process
public boolean process(ResourceEntry entry)
Add the resource entry to the thread-pool for processing, subject to the rate limiting we have to make sure memory consumption is kept in check- Parameters:
entry-- Returns:
-
processThr
public void processThr(ResourceEntry re)
Process the resource in the thread pool- Parameters:
resource-
-
processBadRequest
protected void processBadRequest(ResourceEntry re, FhirServerResponse response)
Record the error in the database- Parameters:
re-response-
-
init
public void init()
-
-