Richard Eckart de Castilho <rec@...> writes:

> 
> Thanks for the report. This hasn't been noticed so far.
> 
> I am afraid that SimplePipeline currently does not support sharing
> a resource between the reader and the components.
> 
> Internally, SimplePipeline instantiates the reader and the components
> separately, thus they end up with different resource managers.
> Resources can only be shared by components that use the same resource
> manager.
> 
> As a workaround, you could try the following:
> 
> - Create the reader and component descriptions as usual with uimaFIT.
> - Use UIMAFramework.newDefaultResourceManager() to create a resource 
manager.
> - Use UIMAFramework.produceCollectionReader() and 
UIMAFramework.produceAnalysisEngine()
> to create CollectionReader and AnalysisEngine instances from the 
descriptors and with your resource manager.
> - Pass the CollectionReader and AnalysisEngine instances as parameters to 
SimplePipeline.
> - Mind that you'll have to call the "collectionProcessComplete" and 
"destroy" methods manually on the
> instances after SimplePipeline is complete - if you need these events.
> 
> I think that should work, but I currently have no time to try it out.
> 
> Sounds like something that should be fixable for the next uimaFIT release. 
Would you mind opening a bug for
> that on the Apache Jira?
> 
> Cheers,
> 


Indeed, I followed your steps and now they are all using the same instance:
MyCollectionReader:com.example.MyExternalResource@32dcb03b
MyAnnotatorA:com.example.MyExternalResource@32dcb03b
MyAnnotatorB:com.example.MyExternalResource@32dcb03b


Reply via email to