org.apache.uima.cas.CAS.release()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.uima.cas.CAS.release()方法的一些代码示例,展示了CAS.release()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CAS.release()方法的具体详情如下:
包路径:org.apache.uima.cas.CAS
类名称:CAS
方法名:release

CAS.release介绍

暂无

代码示例

代码示例来源:origin: org.apache.uima/ruta-core

@Override
public void collectionProcessComplete() {
 if (outView != null) {
  outView.release();
 }
 outView = null;
}

代码示例来源:origin: org.apache.uima/uimaj-as-core

public void dropCAS(CAS aCAS) {
 if (aCAS != null) {
  // Check if this method was called while another thread is stopping the service.
  // This is a special case. Normally the releasedAllCASes is false. It is only
  // true if another thread forcefully released CASes.
  if (releasedAllCASes) {
   // All CASes could have been forcefully released in the stop() method. If another
   // thread was operating on a CAS while the stop() was releasing the CAS we may
   // get an exception which will be ignored. We are shutting down. The forceful
   // CAS release is not part of the graceful. In that case, stop() is only called
   // when ALL CASes are fully processed. Only than stop() is called and since ALL
   // CASes are released at that point we would not see any exceptions.
   try {
    aCAS.release();
   } catch (Exception e) {
   }
  } else {
   aCAS.release();
  }
 }
}

代码示例来源:origin: DigitalPebble/behemoth

public void close() {
  if (cas != null)
    cas.release();
  if (tae != null)
    tae.destroy();
}

代码示例来源:origin: org.apache.uima/uimaj-as-core

public void destroy() {
 callbackListeners.clear();
 Set<Entry<String, CacheEntry>> set = cache.entrySet();
 for (Iterator<Entry<String, CacheEntry>> it = set.iterator(); it.hasNext();) {
  Map.Entry<String, CacheEntry> entry = (Map.Entry<String, CacheEntry>) it.next();
  CacheEntry cacheEntry = (CacheEntry) entry.getValue();
  if (cacheEntry != null && cacheEntry.getCas() != null) {
   try {
    cacheEntry.getCas().release();
   } catch (Exception e) {
   }
  }
 }
 cache.clear();
}

代码示例来源:origin: org.apache.uima/uimaj-as-jms

private void releaseCacheEntries() {
 Iterator it = clientCache.keySet().iterator();
 while (it.hasNext()) {
  ClientRequest entry = clientCache.get((String) it.next());
  if (entry != null && entry.getCAS() != null) {
   entry.getCAS().release();
  }
 }
}

代码示例来源:origin: org.apache.uima/uimaj-as-core

public void releaseAllCASes() {
 Iterator<String> it = cache.keySet().iterator();
 while (it.hasNext()) {
  String key = (String) it.next();
  CacheEntry entry = (CacheEntry) cache.get(key);
  if (entry != null && entry.getCas() != null) {
   try {
    entry.getCas().release();
   } catch (Exception e) {
   }
  }
  cache.remove(key);
 }
}

代码示例来源:origin: DigitalPebble/behemoth

public void close() throws IOException {
  if (cas != null)
    cas.release();
  if (tae != null)
    tae.destroy();
  if (installDir != null) {
    FileUtils.deleteRecursive(installDir);
  }
}

代码示例来源:origin: apache/uima-uimaj

public void release() {
 // pop all frames off the casIteratorStack, calling Flow.abort() on flow objects and
 //CasIterator.release() on the CAS iterators
 while (!casIteratorStack.isEmpty()) {
  StackFrame frame = casIteratorStack.pop();
  frame.originalCasFlow.aborted();
  frame.casIterator.release();
 }
 
 // release all active, internal CASes
 Iterator<CAS> iter = activeCASes.iterator();
 while (iter.hasNext()) {
  CAS cas = iter.next();
  // mFlowControllerContainer.dropCas(cas);
  if (cas != mInputCas) // don't release the input CAS, it's caller's responsibility
  {
   cas.release();
  }
 }
 //clear the active CASes list, to guard against ever trying to
 //reuse these CASes or trying to release them a second time.
 activeCASes.clear();       
}

代码示例来源:origin: org.apache.uima/uimaj-as-core

public void releaseCASesProducedFromInputCAS(String anInputCASReferenceId) {
 if (anInputCASReferenceId == null) {
  return;
 }
 Iterator<String> it = cache.keySet().iterator();
 while (it.hasNext()) {
  String key = (String) it.next();
  CacheEntry entry = (CacheEntry) cache.get(key);
  if (entry != null
      && (anInputCASReferenceId.equals(key) || anInputCASReferenceId.equals(entry
          .getInputCasReferenceId()))) {
   if (entry.getCas() != null) {
    entry.getCas().release();
   }
   remove(key);
  }
 }
}

代码示例来源:origin: edu.cmu.lti.oaqa.ecd/uima-ecd

/**
 * Run a sequence of {@link AnalysisEngine analysis engines} over a {@link CAS}. This method
 * does not {@link AnalysisEngine#destroy() destroy} the engines or send them other events like
 * {@link AnalysisEngine#collectionProcessComplete()}. This is left to the caller.
 *
 * @param cas
 *            the CAS to process
 * @param engines
 *            a sequence of analysis engines to run on the jCas
 * @throws UIMAException
 * @throws IOException
 */
public static void runPipeline(final CAS cas, final AnalysisEngine... engines)
  throws UIMAException, IOException {
 if (engines.length == 0) {
  return;
 }
 CasIterator casIter = engines[0].processAndOutputNewCASes(cas);
 AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length);
 while (casIter.hasNext()) {
  CAS nextCas = casIter.next();
  runPipeline(nextCas, enginesRemains);
  nextCas.release();
 }
}

代码示例来源:origin: edu.cmu.lti.oaqa.cse/cse-framework

void runPipeline(final CAS cas, final AnalysisEngine engine, CasProcessedCallback callback)
     throws UIMAException, IOException {
  CasIterator it = engine.processAndOutputNewCASes(cas);
  while (it.hasNext()) {
   CAS output = it.next();
   callback.entityProcessComplete(output);
   output.release();
  }
  callback.collectionProcessComplete();
 }
}

代码示例来源:origin: apache/uima-uimaj

public ProcessTrace process(CAS aCAS) throws AnalysisEngineProcessException {
  CasIterator iter = processAndOutputNewCASes(aCAS);
  // step through all output CASes which lets the AE finish all processing
  while (iter.hasNext()) {
   CAS cas = iter.next();
   cas.release();
  }
  // https://issues.apache.org/jira/browse/UIMA-4151
  return isProcessTraceEnabled() ? buildProcessTraceFromMBeanStats() : ProcessTrace_impl.disabledProcessTrace;
//    return buildProcessTraceFromMBeanStats();
 }

代码示例来源:origin: org.apache.uima/ruta-ep-caseditor

XmiCasDeserializer.deserialize(new FileInputStream(selected), dummyCas, true);
 html = dummyCas.getDocumentText();
 dummyCas.release();
} catch (ResourceInitializationException e) {
 RutaCasEditorPlugin.error(e);

代码示例来源:origin: org.apache.uima/ruta-ep-ide-ui

public static void main(String[] args) throws Exception {
 parseCmdLineArgs(args);
 ResourceManager resourceManager = null;
 if (classPath != null) {
  String[] split = classPath.split(File.pathSeparator);
  ClassLoader classLoader = getClassLoader(Arrays.asList(split));
  resourceManager = new ResourceManager_impl(classLoader);
 }
 AnalysisEngine ae = Ruta.wrapAnalysisEngine(descriptor.toURI().toURL(), view, true,
     inputEncoding, resourceManager);
 configure(ae);
 CAS cas = ae.newCAS();
 List<File> inputFiles = getFiles(inputFolder, inputRecursive);
 for (File file : inputFiles) {
  processFile(file, ae, cas);
 }
 ae.batchProcessComplete(new ProcessTrace_impl());
 ae.collectionProcessComplete(new ProcessTrace_impl());
 cas.release();
 ae.destroy();
}

代码示例来源:origin: org.apache.uima/uimaj-as-core

/**
 * Forces initialization of a Cas Pool if this is a Cas Multiplier delegate collocated with an
 * aggregate. The parent aggregate calls this method when all type systems have been merged.
 */
public synchronized void onInitialize() {
 // Component's Cas Pool is registered lazily, when the process() is called for
 // the first time. For monitoring purposes, we need the comoponent's Cas Pool
 // MBeans to register during initialization of the service. For a Cas Multiplier
 // force creation of the Cas Pool and registration of a Cas Pool with the JMX Server.
 // Just get the CAS and release it back to the component's Cas Pool.
 if (isCasMultiplier() && !isTopLevelComponent() ) {
   boolean isUimaAggregate = false;
   if ( !(resourceSpecifier instanceof CollectionReaderDescription) ) {
     //  determine if this AE is a UIMA aggregate
     isUimaAggregate = ((AnalysisEngineDescription) resourceSpecifier).isPrimitive() == false ? true : false;
   }
   if ( !isUimaAggregate ) {  // !uima core aggregate CM
       CAS cas = (CAS) getUimaContext().getEmptyCas(CAS.class);
     cas.release();
   }
 }
}

代码示例来源:origin: org.apache.uima/uimaj-as-jms

timer.cancel();
if (cas != null) {
 cas.release();

代码示例来源:origin: org.apache.uima/uimaj-as-core

entry.getCas().release();

代码示例来源:origin: org.apache.uima/uima-ducc-container

cas.release();

代码示例来源:origin: org.apache.uima/uimaj-as-jms

cas.release();

代码示例来源:origin: org.apache.uima/uimaj-as-jms

cachedRequest.getCAS().release();

相关文章