Hi,
> Thank you for your anwers. Regarding the SharedResourceObject approach
> in the JavaDoc I didn't find any reference about how many instances will be
> created when you have many Annotators using the same resource. I would say
> that that will be one SharedResouce per instance Annotator.
The ResourceManager creates one instance per resource per UIMA context.
> 1.So suppose that you have AnnotatorX and AnnotatorY using the
> SharedResourceObject collocated (same JVM) how many instances of
> SharedResourceObject do we have?
Depends how you deploy your pipelines. Assuming that run a single CPE
(or something the likes) per JVM, there will be a single instance. Each
CPE run creates an UIMA context internally. I don't know how UIMA-AS handles
that. If you run your pipelines with uimaFIT's SimplePipeline, one instance
per call run runPipeline() is created.
> 2.Also, if the AnnotatorX is a remote EA that is using the
> SharedResourceObject with a scale out factor of 3, how many instances of
> SharedResourceObject will be created?
As the name says, the instance is shared - so one instance.
> What I'm afraid, that given the ApplicationContext on some point we have
> to destroy it. As far as I know this can be achieve in the destroy method
> of the annotator. But if we have a single SharedResourceObject shared among
> annotators probably will be a mess to destroy the context from each of the
> instances.
It seems that UIMA does currently not support a full lifecycle management
for external resources. It can create the, but they are not notified in any way
when the UIMA context/ResourceManager goes out of business.
You could implement a check-out/return mechanism: increment a counter variable
in the resource every time an analysis engine calls a certain method on the
resource. In the destroy() method of the analysis engine, call another method
to decrement the counter. If the counter reaches 0 at the end of the
decrement method, call your resource's destroy() logic.
> I would like to ask you if this code is proper solution for our case
>
> MyCasConsumer {
>
> private ApplicationContext springContext;
>
> void initialize() {
> springContext = new ClassPathXmlApplicationContext("spring-context.xml");
> }
>
> void destroy() {
> springContext.close();
> }
> }
I wouldn't call a shared resource "CasConsumer". Also, CasConsumer's normally
don't scale because they have the MULTIPLE_DEPLOYMENT_ALLOWED_DEFAULT flag set
to "false".
-- Richard
--
-------------------------------------------------------------------
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab (UKP-TUD)
FB 20 Computer Science Department
Technische Universität Darmstadt
Hochschulstr. 10, D-64289 Darmstadt, Germany
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckart@ukp.informatik.tu-darmstadt.de
www.ukp.tu-darmstadt.de
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
-------------------------------------------------------------------
|