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 037FCEAAE for ; Thu, 22 Nov 2012 13:13:58 +0000 (UTC) Received: (qmail 15016 invoked by uid 500); 22 Nov 2012 13:13:57 -0000 Delivered-To: apmail-uima-user-archive@uima.apache.org Received: (qmail 14746 invoked by uid 500); 22 Nov 2012 13:13:56 -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 14720 invoked by uid 99); 22 Nov 2012 13:13:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Nov 2012 13:13:56 +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; Thu, 22 Nov 2012 13:13:49 +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 qAMDDP7r001901 for ; Thu, 22 Nov 2012 14:13:25 +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; Thu, 22 Nov 2012 14:11:50 +0100 From: Richard Eckart de Castilho To: "" Subject: Re: Dependency injection support in UIMA Thread-Topic: Dependency injection support in UIMA Thread-Index: AQHNxyIh2YcHJV2rlUS1XKhPt/DXopfywlsAgAAOgQCAAAfjAIABhVaAgAAuJYCAATkKgIAAAY8A Date: Thu, 22 Nov 2012 13:11:48 +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="iso-8859-1" Content-ID: <3283E233FE649547B4BBE90442549B96@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.22.130629 X-PMX-RELAY: outgoing X-Virus-Checked: Checked by ClamAV on apache.org Hi, I'm afraid I'm not very familiar with UIMA AS. The context resource and con= sumer look reasonable to me. -- Richard Am 22.11.2012 um 14:06 schrieb Spico Florin : > Hello! > I'm deploying my Consumer in AS environment. My consumer is a remote > component with scaleout factor of 3. The consumer tries to get an instanc= e > to a triplestore template that has reference to a triplestore pooled > connection. After profiling the deployed consumer with the given set up, = I > found that there is *ONE* instance of SharedResourceObject and also 3 > instances of consumer. Can you please have a look over the following code > snippets and check if it is UIMA AS compliant? > package com; > public class SpringResource implements SharedResourceObject { > private AbstractApplicationContext context; > private AtomicInteger counter =3D new AtomicInteger(); >=20 > public void load(DataResource aData) throws > ResourceInitializationException { > context =3D new ClassPathXmlApplicationContext(aData.getUri().toString= ()); > } >=20 > public AbstractApplicationContext getContext() { > return context; > } > public void *registerComponent()* { > * counter.incrementAndGet(); > *} > public void *unregisterComponent()* { > if (counter.get() > 0) { > *counter.decrementAndGet();* > } > if (counter.get() =3D=3D 0) { > *context.close();* > } > } > }//consumer >=20 > public class SpringCasConsumer extends CasConsumer_ImplBase { > public void initialize() throws ResourceInitializationException { > * * try { > * SpringResource shared =3D (SpringResource) > getUimaContext().getResourceObject("Resource"); > shared.getContext().getBean("myBean"); > shared.registerComponent(); > * } catch (ResourceAccessException e) { > } > } > public void destroy() { > * shared.unregisterComponent(); > super.destroy(); > *} > } > //deployment descriptor for UIMA AS >=20 > http://uima.apache.org/resourceSpecifier"> >=20 > Consumer > > * > * > > > > > > ** > > > > >=20 > Configururation for resource manager: >=20 > > > > *springResource* > > > file:spring_context.xml > > *com.SpringResource* > > > > > Resource* > *springResource* > > > >=20 > Thank you. > Regards, > Florin --=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