uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shahid ashraf <sha...@trialx.com>
Subject Re: CAS Pool
Date Fri, 10 Feb 2017 16:09:59 GMT
Anything on the previous mail and

*Also i tried the setting up  Cas Pool based on descriptor file using below
code... when i increase the number of threads from 1 i get following errors*

public class MyApplication {
  private CasPool mCasPool;

  private AnalysisEngine mAnalysisEngine;

  public MyApplication()
  {
    //get Resource Specifier from XML file
    XMLInputSource in = new XMLInputSource("MyDescriptor.xml");
    ResourceSpecifier specifier =
      UIMAFramework.getXMLParser().parseResourceSpecifier(in);

    //Create multithreadable AE that will
    //Accept 3 simultaneous requests
    //The 3rd parameter specifies a timeout.
    //When the number of simultaneous requests exceeds 3,
    // additional requests will wait for other requests to finish.
    // This parameter determines the maximum number of milliseconds
    // that a new request should wait before throwing an
    // - a value of 0 will cause them to wait forever.
    mAnalysisEngine = UIMAFramework.produceAnalysisEngine(specifier,3,0);

    //create CAS pool with 3 CAS instances
    mCasPool = new CasPool(3, mAnalysisEngine);
  }

  // Notice this is no longer "synchronized"
  public void analyzeDocument(String aDoc) {
    //check out a CAS instance (argument 0 means no timeout)
    CAS cas = mCasPool.getCas(0);
    try {
      //analyze a document
      cas.setDocumentText(aDoc);
      mAnalysisEngine.process(cas);
      doSomethingWithResults(cas);
    } finally {
      //MAKE SURE we release the CAS instance
      mCasPool.releaseCas(cas);
    }
  }
  ...
}

eb 10, 2017 8:44:06 PM
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl
callAnalysisComponentProcess(430)

SEVERE: Exception occurred

org.apache.uima.analysis_engine.AnalysisEngineProcessException

	at org.apache.ctakes.lvg.ae.LvgAnnotator.process(LvgAnnotator.java:310)

	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)

	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:396)

	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:314)

	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:570)

	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:412)

	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:265)aused
by: org.apache.uima.analysis_engine.AnalysisEngineProcessException

at
org.apache.ctakes.lvg.ae.LvgAnnotator.setCanonicalForm(LvgAnnotator.java:372)

at
org.apache.ctakes.lvg.ae.LvgAnnotator.annotateRange(LvgAnnotator.java:342)

at org.apache.ctakes.lvg.ae.LvgAnnotator.process(LvgAnnotator.java:307)

... 35 more
Caused by: java.lang.NullPointerException

Feb 10, 2017 8:44:06 PM
org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl
processAndOutputNewCASes(273)

SEVERE: Exception occurred

org.apache.uima.analysis_engine.AnalysisEngineProcessException

	at org.apache.ctakes.lvg.ae.LvgAnnotator.process(LvgAnnotator.java:310)

	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)

	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:396)

	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:314)

	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:570)

	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:412)

	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)

	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:265)
	at



On Fri, Feb 10, 2017 at 12:12 AM, shahid ashraf <shahid@trialx.com> wrote:

>
> Hi Folks
>
> This is my first mail to the mailing list. I have just started looking
> into the uima architecture. Currently i am trying few things in ctakes. I
> need to use the JCAS pool for multithreading. https://uima.
> apache.org/d/uimaj-current/tutorials_and_users_guides.
> html#ugr.tug.applications.multi_threaded
> I need to know the equivalent of the following while using programmable
> bluider AE(org.apache.uima.fit.factory.AggregateBuilder;)
>
> mAnalysisEngine = UIMAFramework.produceAnalysisEngine(specifier,3,0);
>
> Currently i am building aggregate AE like this ... in which i need to set
> the property/field to 3 like in above.
>
> *In other words the questions is how to use the cas object pool for
> multiprocessing iusing programmable interface(AggregrateBuilder) instead of
> descriptor file approach.*
>
> --
> with Regards
> Shahid Ashraf
>



-- 
with Regards
Shahid Ashraf

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message