You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Duan, Nick" <Ni...@ManTech.com> on 2009/05/15 17:45:28 UTC

Cas Consumer Init Problem with Multi-threads

My apology if this is a known issue or someone already got a solution.

I configured a CPE with 2 threads.  The output directory of the CAS consumer in the CPE was set dynamically using the ConfigurableResource's setConfiParameterValue API at runtime to override what was defined in the CASConsumer descriptor.  The problem I encountered was the output files were generated into two separated directories, one is the original one defined in the CC descriptor, while the other is the one set dynamically at runtime.  

Apparently CPE is creating 2 CAS Consumer instances for the 2 threads, respectively.  But it only resets one instance with the dynamic value, while the other still uses the static value defined in the descriptor.  Certain this problem doesn't occur when running a single thread.

Any advise on how to solve the problem is highly appreciated.

Nick
This communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain company proprietary and legally privileged information.  If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of this message is strictly prohibited.  If you have received this in error, please reply immediately to the sender and delete this message.  Thank you.

Re: Cas Consumer Init Problem with Multi-threads

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Nick,please post part of your code that changes the value of the CC
property. I think there are two ways to change the property:

1) Change the property value via CpeDescription object. This would be a
preferred way since the change is made on the descriptor object before the
CPE instantiates CasProcessors.

2) Change the property value via CasProcessor object. In this case, the
application calls
public CasProcessor[] getCasProcessors() on the BaseCPMImpl object to get a
list of CasProcessors. These are *instances* that have been initialized from
the descriptor object. Subsequently you iterate over the list and find the
CasProcessor you want to change, and finally you change the property via
CasProcessor API:

            public ConfigurationParameterSettings getParameterSettings()


I have a feeling that your code is changing the property using method #2.
And it seems that you are only changing the property on one instance of the
CasProcessor. The list returned may contain more than one instance of
specific CasProcessor. How many instances you get depends on how many
processing threads there are and whether or not the CasProcessor is
parallizable.In your case there would be two instances of CC in the list.

If you want to use method #2 you need to scan the list returned from
getCasProcessors() for *ALL* instances of the CasProcessor you want to
modify.


Regards, Jerry

On Fri, May 15, 2009 at 11:45 AM, Duan, Nick <Ni...@mantech.com> wrote:

> My apology if this is a known issue or someone already got a solution.
>
> I configured a CPE with 2 threads.  The output directory of the CAS
> consumer in the CPE was set dynamically using the ConfigurableResource's
> setConfiParameterValue API at runtime to override what was defined in the
> CASConsumer descriptor.  The problem I encountered was the output files were
> generated into two separated directories, one is the original one defined in
> the CC descriptor, while the other is the one set dynamically at runtime.
>
> Apparently CPE is creating 2 CAS Consumer instances for the 2 threads,
> respectively.  But it only resets one instance with the dynamic value, while
> the other still uses the static value defined in the descriptor.  Certain
> this problem doesn't occur when running a single thread.
>
> Any advise on how to solve the problem is highly appreciated.
>
> Nick
> This communication, along with any attachments, is covered by federal and
> state law governing electronic communications and may contain company
> proprietary and legally privileged information.  If the reader of this
> message is not the intended recipient, you are hereby notified that any
> dissemination, distribution, use or copying of this message is strictly
> prohibited.  If you have received this in error, please reply immediately to
> the sender and delete this message.  Thank you.
>