Package com.ibm.fhir.bucket.scanner
Class COSReader
- java.lang.Object
-
- com.ibm.fhir.bucket.scanner.COSReader
-
public class COSReader extends Object
Grabs work from the bucket database and dispatches items to the thread pool.
-
-
Constructor Summary
Constructors Constructor Description COSReader(ExecutorService commonPool, FileType fileType, COSClient client, Consumer<ResourceEntry> resourceHandler, int maxInflight, DataAccess da, boolean incremental, int recycleSeconds, boolean incrementalExact, double bundleCostFactor, Collection<BucketPath> bucketPaths)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
init()
start the allocation threadvoid
mainAllocationLoop()
The main loop of this active objectprotected void
markJobDone(BucketLoaderJob job)
Callback when the last record in the job completesprotected boolean
process(BucketLoaderJob job, Resource resource, int lineNumber, String line)
Process the resource parsed from the input streamvoid
processNDJSON(BucketLoaderJob job, BufferedReader br)
Read the resources from the given readervoid
signalStop()
Tell the main thread of this active object that it should start shutting downList<OperationOutcome.Issue>
validateInput(Resource resource)
Validate the input resource and throw if there are validation errorsvoid
waitForStop()
Tell the main loop thread to stop
-
-
-
Constructor Detail
-
COSReader
public COSReader(ExecutorService commonPool, FileType fileType, COSClient client, Consumer<ResourceEntry> resourceHandler, int maxInflight, DataAccess da, boolean incremental, int recycleSeconds, boolean incrementalExact, double bundleCostFactor, Collection<BucketPath> bucketPaths)
Public constructor- Parameters:
commonPool
- thread pool shared by the readers and request handlerfileType
- the file type this read is responsible for processingclient
-resourceHandler
-poolSize
-da
-incremental
-recycleSeconds
-
-
-
Method Detail
-
signalStop
public void signalStop()
Tell the main thread of this active object that it should start shutting down
-
waitForStop
public void waitForStop()
Tell the main loop thread to stop
-
init
public void init()
start the allocation thread
-
mainAllocationLoop
public void mainAllocationLoop()
The main loop of this active object
-
markJobDone
protected void markJobDone(BucketLoaderJob job)
Callback when the last record in the job completes- Parameters:
job
-
-
processNDJSON
public void processNDJSON(BucketLoaderJob job, BufferedReader br)
Read the resources from the given reader- Parameters:
is
-
-
process
protected boolean process(BucketLoaderJob job, Resource resource, int lineNumber, String line)
Process the resource parsed from the input stream- Parameters:
details
- of the job being processedresource
- parsed from the resource_bundle being processedlineNumber
- the line number of this resource in the sourceline
- the original resource string, for logging if we need to
-
validateInput
public List<OperationOutcome.Issue> validateInput(Resource resource) throws FHIRValidationException, FHIROperationException
Validate the input resource and throw if there are validation errors- Parameters:
resource
-- Throws:
FHIRValidationException
FHIROperationException
-
-