Hello!
I really appreciate your support Richard. I'll go for this
implementation. I hope that someone from UIMA AS will get into this topic
and validate the solution.
Regards,
Florin
On Thu, Nov 22, 2012 at 3:11 PM, Richard Eckart de Castilho <
eckart@ukp.informatik.tu-darmstadt.de> wrote:
> Hi,
>
> I'm afraid I'm not very familiar with UIMA AS. The context resource and
> consumer look reasonable to me.
>
> -- Richard
>
> Am 22.11.2012 um 14:06 schrieb Spico Florin <spicoflorin@gmail.com>
> :
>
> > 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
> instance
> > 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 = new AtomicInteger();
> >
> > public void load(DataResource aData) throws
> > ResourceInitializationException {
> > context = new
> ClassPathXmlApplicationContext(aData.getUri().toString());
> > }
> >
> > public AbstractApplicationContext getContext() {
> > return context;
> > }
> > public void *registerComponent()* {
> > * counter.incrementAndGet();
> > *}
> > public void *unregisterComponent()* {
> > if (counter.get() > 0) {
> > *counter.decrementAndGet();*
> > }
> > if (counter.get() == 0) {
> > *context.close();*
> > }
> > }
> > }//consumer
> >
> > public class SpringCasConsumer extends CasConsumer_ImplBase {
> > public void initialize() throws ResourceInitializationException {
> > * * try {
> > * SpringResource shared = (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
> >
> > <analysisEngineDeploymentDescription xmlns="
> > http://uima.apache.org/resourceSpecifier">
> >
> > <name>Consumer</name>
> > <deployment protocol="jms" provider="activemq">
> > *<casPool numberOfCASes="3"/>
> > *<service>
> > <inputQueue endpoint="ConsumerQueue"
> brokerURL="${defaultBrokerURL}"/>
> > <topDescriptor>
> > <import location="../../desc/cas_consumer/SpringConsumer.xml"/>
> > </topDescriptor>
> > <analysisEngine>
> > *<scaleout numberOfInstances="3"/>*
> > </analysisEngine>
> > </service>
> > </deployment>
> > </analysisEngineDeploymentDescription>
> >
> > Configururation for resource manager:
> >
> > <resourceManagerConfiguration>
> > <externalResources>
> > <externalResource>
> > <name>*springResource*</name>
> > <description/>
> > <fileResourceSpecifier>
> > <fileUrl>file:spring_context.xml</fileUrl>
> > </fileResourceSpecifier>
> > <implementationName>*com.SpringResource*</implementationName>
> > </externalResource>
> > </externalResources>
> > <externalResourceBindings>
> > <externalResourceBinding>
> > <key*>Resource*</key>
> > <resourceName>*springResource*</resourceName>
> > </externalResourceBinding>
> > </externalResourceBindings>
> > </resourceManagerConfiguration>
> >
> > Thank you.
> > Regards,
> > Florin
>
>
> --
> -------------------------------------------------------------------
> 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
> -------------------------------------------------------------------
>
>
>
>
>
>
>
|