// Release the CAS and notify listeners if the end of the
// pipeline is reached.
if ((releaseCAS) && (i == (processContainers.size() - 1))) {
// This flag is used to prevent multiple notifications
doneAlready = true;
EntityProcessStatus aEntityProcStatus = new EntityProcessStatusImpl(pTrTemp);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_notify_listeners__FINEST",
new Object[] { Thread.currentThread().getName() });
}
threadState = 2007;
notifyListeners(aCasObjectList, isCasObject, aEntityProcStatus);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_done_notify_listeners__FINEST",
new Object[] { Thread.currentThread().getName() });
UIMAFramework.getLogger(this.getClass()).logrb(
Level.FINEST,
this.getClass().getName(),
"process",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_releasing_cases__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName(),
String.valueOf(releaseCAS), String.valueOf(true) });
}
if (casCache != null) {
clearCasCache();
}
// Release CAS's.
if (aCasObjectList instanceof CAS[]) {
cpm.releaseCASes((CAS[]) aCasObjectList);
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_done_releasing_cases__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName() });
}
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_pipeline_completed__FINEST",
new Object[] { Thread.currentThread().getName() });
}
retry = false;
// On successfull processing reset the restart counter. Restart counter determines how
// many times to restart Cas Processor on the same CAS
// Do this conditionally. If the CAS is to be dropped on Exception this restart counter
// scope extends to the entire collection not just one CAS
if (!cpm.dropCasOnException()) {
container.resetRestartCount();
}
} catch (Exception e) {
e.printStackTrace();
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
UIMAFramework.getLogger(this.getClass()).logrb(
Level.SEVERE,
this.getClass().getName(),
"process",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_pipeline_exception__SEVERE",
new Object[] { Thread.currentThread().getName(), container.getName(),
e.getMessage() });
UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE,
Thread.currentThread().getName(), e);
UIMAFramework.getLogger(this.getClass()).logrb(
Level.FINEST,
this.getClass().getName(),
"process",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_pipeline_exception__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName(),
String.valueOf(container.isPaused()) });
}
EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(pTrTemp);
enProcSt.addEventStatus("Process", "Failed", e);
threadState = 2008;
notifyListeners(aCasObjectList, isCasObject, enProcSt);
doneAlready = true;
threadState = 2009;