Package org.apache.uima.util

Examples of org.apache.uima.util.CasPool


   * (non-Javadoc)
   *
   * @see org.apache.uima.resource.CasManager#getCAS(org.apache.uima.analysis_engine.AnalysisEngine)
   */
  public CAS getCas(String aRequestorContextName) {
    CasPool pool = (CasPool) mRequestorToCasPoolMap.get(aRequestorContextName);
    if (pool == null) {
      throw new UIMARuntimeException(UIMARuntimeException.REQUESTED_TOO_MANY_CAS_INSTANCES,
              new Object[] { aRequestorContextName, "1", "0" });
    }
    return pool.getCas(0);
  }
View Full Code Here


   * (non-Javadoc)
   *
   * @see org.apache.uima.resource.CasManager#releaseCAS(org.apache.uima.cas.CAS)
   */
  public void releaseCas(AbstractCas aCAS) {
    CasPool pool = (CasPool) mCasToCasPoolMap.get(aCAS);
    if (pool == null) {
      // CAS doesn't belong to this CasManager!
      throw new UIMARuntimeException(UIMARuntimeException.CAS_RELEASED_TO_WRONG_CAS_MANAGER,
              new Object[0]);
    } else {
      //see if we have a UimaContext that we can notify that CAS was release
      UimaContextAdmin uc = (UimaContextAdmin)mCasToUimaContextMap.get(aCAS);
      if (uc != null) {
        uc.returnedCAS(aCAS);
      }
     
      //release the CAS
      pool.releaseCas((CAS) aCAS);
    }
  }
View Full Code Here

   */
  private void defineCasPool(UimaContext aRequestorContext, String aRequestorContextName, int aMinimumSize,
          Properties aPerformanceTuningSettings) throws ResourceInitializationException {
    int poolSize = getCasPoolSize(aRequestorContextName, aMinimumSize);
    if (poolSize > 0) {
      CasPool pool = (CasPool) mRequestorToCasPoolMap.get(aRequestorContextName);
      if (pool == null) {
        // this requestor hasn't requested a CAS before
        pool = new CasPool(poolSize, this, aPerformanceTuningSettings);
        populateCasToCasPoolAndUimaContextMaps(pool, aRequestorContext);
        mRequestorToCasPoolMap.put(aRequestorContextName, pool);
        //register with JMX
        registerCasPoolMBean(aRequestorContextName, pool);

View Full Code Here

   * (non-Javadoc)
   *
   * @see org.apache.uima.resource.CasManager#getCAS(org.apache.uima.analysis_engine.AnalysisEngine)
   */
  public CAS getCas(String aRequestorContextName) {
    CasPool pool = (CasPool) mRequestorToCasPoolMap.get(aRequestorContextName);
    if (pool == null) {
      throw new UIMARuntimeException(UIMARuntimeException.REQUESTED_TOO_MANY_CAS_INSTANCES,
              new Object[] { aRequestorContextName, "1", "0" });
    }
    return pool.getCas(0);
  }
View Full Code Here

          new Object[] {aCAS.getClass()});
    }
    CASImpl baseCas = (aCAS instanceof JCas) ? ((JCas)aCAS).getCasImpl().getBaseCAS()
                                             : ((CASImpl)aCAS).getBaseCAS();

    CasPool pool = (CasPool) mCasToCasPoolMap.get(baseCas);
    if (pool == null) {
      // CAS doesn't belong to this CasManager!
      throw new UIMARuntimeException(UIMARuntimeException.CAS_RELEASED_TO_WRONG_CAS_MANAGER,
              new Object[0]);
    } else {
      //see if we have a UimaContext that we can notify that CAS was release
      UimaContextAdmin uc = (UimaContextAdmin)mCasToUimaContextMap.get(baseCas);
      if (uc != null) {
        uc.returnedCAS(aCAS);
      }
     
      //release the CAS
      pool.releaseCas((CAS) aCAS);
    }
  }
View Full Code Here

   */
  private synchronized void defineCasPool(UimaContext aRequestorContext, String aRequestorContextName, int aMinimumSize,
          Properties aPerformanceTuningSettings) throws ResourceInitializationException {
    int poolSize = getCasPoolSize(aRequestorContextName, aMinimumSize);
    if (poolSize > 0) {
      CasPool pool = (CasPool) mRequestorToCasPoolMap.get(aRequestorContextName);
      if (pool == null) {
        // this requestor hasn't requested a CAS before
        pool = new CasPool(poolSize, this, aPerformanceTuningSettings);
        populateCasToCasPoolAndUimaContextMaps(pool, aRequestorContext);
        mRequestorToCasPoolMap.put(aRequestorContextName, pool);
        //register with JMX
        registerCasPoolMBean(aRequestorContextName, pool);

View Full Code Here

      mAE = UIMAFramework
              .produceAnalysisEngine(resourceSpecifier, descriptor.getInstanceCount(), 0);
    }
    // create pool of CASes
    if (mCasPool == null) {
      mCasPool = new CasPool(descriptor.getInstanceCount(), mAE);
    }
  }
View Full Code Here

      mAE = UIMAFramework
              .produceAnalysisEngine(resourceSpecifier, descriptor.getInstanceCount(), 0);
    }
    // create pool of CASes
    if (mCasPool == null) {
      mCasPool = new CasPool(descriptor.getInstanceCount(), mAE.getProcessingResourceMetaData());
    }

    // invoke type system init once on CAS Processor
    CAS cas = mCasPool.getCas();
    try {
View Full Code Here

      mAE = UIMAFramework
              .produceAnalysisEngine(resourceSpecifier, descriptor.getInstanceCount(), 0);
    }
    // create pool of CASes
    if (mCasPool == null) {
      mCasPool = new CasPool(descriptor.getInstanceCount(), mAE.getProcessingResourceMetaData());
    }

    // invoke type system init once on CAS Processor
    CAS cas = mCasPool.getCas();
    try {
View Full Code Here

      mAE = UIMAFramework
              .produceAnalysisEngine(resourceSpecifier, descriptor.getInstanceCount(), 0);
    }
    // create pool of CASes
    if (mCasPool == null) {
      mCasPool = new CasPool(descriptor.getInstanceCount(), mAE);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.util.CasPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.