@Override public void collectionProcessComplete() { if (outView != null) { outView.release(); } outView = null; }
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(); } } }
public void close() { if (cas != null) cas.release(); if (tae != null) tae.destroy(); }
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(); }
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(); } } }
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); } }
public void close() throws IOException { if (cas != null) cas.release(); if (tae != null) tae.destroy(); if (installDir != null) { FileUtils.deleteRecursive(installDir); } }
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(); }
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); } } }
/** * 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(); } }
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(); } }
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(); }
XmiCasDeserializer.deserialize(new FileInputStream(selected), dummyCas, true); html = dummyCas.getDocumentText(); dummyCas.release(); } catch (ResourceInitializationException e) { RutaCasEditorPlugin.error(e);
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(); }
/** * 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(); } } }
timer.cancel(); if (cas != null) { cas.release();
entry.getCas().release();
cachedRequest.getCAS().release();