Return-Path: X-Original-To: apmail-uima-user-archive@www.apache.org Delivered-To: apmail-uima-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C93D5DCE5 for ; Wed, 21 Nov 2012 18:26:25 +0000 (UTC) Received: (qmail 18266 invoked by uid 500); 21 Nov 2012 18:26:25 -0000 Delivered-To: apmail-uima-user-archive@uima.apache.org Received: (qmail 18233 invoked by uid 500); 21 Nov 2012 18:26:25 -0000 Mailing-List: contact user-help@uima.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@uima.apache.org Delivered-To: mailing list user@uima.apache.org Received: (qmail 18225 invoked by uid 99); 21 Nov 2012 18:26:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2012 18:26:25 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [130.83.156.225] (HELO lnx500.hrz.tu-darmstadt.de) (130.83.156.225) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2012 18:26:18 +0000 Received: from mx.ukp.informatik.tu-darmstadt.de (fansworth.ukp.informatik.tu-darmstadt.de [130.83.167.132]) by lnx500.hrz.tu-darmstadt.de (8.14.4/8.14.4/HRZ/PMX) with ESMTP id qALIPqiA011538 for ; Wed, 21 Nov 2012 19:25:52 +0100 (envelope-from eckart@ukp.informatik.tu-darmstadt.de) Received: from amy.ukp.informatik.tu-darmstadt.de ([fe80::e194:b7dc:c046:9b16]) by FANSWORTH.ukp.informatik.tu-darmstadt.de ([fe80::4462:cc70:fa72:847e%14]) with mapi id 14.02.0318.004; Wed, 21 Nov 2012 19:25:52 +0100 From: Richard Eckart de Castilho To: "" Subject: Re: Dependency injection support in UIMA Thread-Topic: Dependency injection support in UIMA Thread-Index: AQHNxyIh2YcHJV2rlUS1XKhPt/DXopfywlsAgAAOgQCAAAfjAIABhVaAgAAuJYA= Date: Wed, 21 Nov 2012 18:25:51 +0000 Message-ID: References: In-Reply-To: Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [130.83.167.135] Content-Type: text/plain; charset="Windows-1252" Content-ID: <9EB8F5512FD07442881892C64BD408CF@ukp.informatik.tu-darmstadt.de> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-PMX-TU: seen v1.2 by 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.11.21.181229 X-PMX-RELAY: outgoing X-Virus-Checked: Checked by ClamAV on apache.org 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 sa= y > 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 handle= s 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 amo= ng > annotators probably will be a mess to destroy the context from each of th= e > 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 varia= ble 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 meth= od to decrement the counter. If the counter reaches 0 at the end of the=20 decrement method, call your resource's destroy() logic. > I would like to ask you if this code is proper solution for our case >=20 > MyCasConsumer { >=20 > private ApplicationContext springContext; >=20 > void initialize() { > springContext =3D new ClassPathXmlApplicationContext("spring-context.xm= l"); > } >=20 > void destroy() { > springContext.close(); > } > } I wouldn't call a shared resource "CasConsumer". Also, CasConsumer's normal= ly don't scale because they have the MULTIPLE_DEPLOYMENT_ALLOWED_DEFAULT flag = set to "false". -- Richard --=20 -------------------------------------------------------------------=20 Richard Eckart de Castilho Technical Lead Ubiquitous Knowledge Processing Lab (UKP-TUD)=20 FB 20 Computer Science Department =20 Technische Universit=E4t Darmstadt=20 Hochschulstr. 10, D-64289 Darmstadt, Germany=20 phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117 eckart@ukp.informatik.tu-darmstadt.de=20 www.ukp.tu-darmstadt.de=20 Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de -------------------------------------------------------------------=20