Author: cwiklik
Date: Fri Sep 3 15:51:34 2010
New Revision: 992337
URL: http://svn.apache.org/viewvc?rev=992337&view=rev
Log:
UIMA-1850 Modified handleError() to only drop CASes that have no children
Modified:
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
Modified:
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
URL:
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java?rev=992337&r1=992336&r2=992337&view=diff
==============================================================================
---
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
(original)
+++
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
Fri Sep 3 15:51:34 2010
@@ -218,19 +218,24 @@ public class ProcessCasErrorHandler exte
new Object[] { aController.getComponentName(),
t.getClass().getName() });
}
if (casReferenceId != null) {
- // Cleanup resources associated with a CAS and then release the CAS
- try {
- if (aController instanceof AggregateAnalysisEngineController) {
- ((AggregateAnalysisEngineController)
aController).dropFlow(casReferenceId, true);
- ((AggregateAnalysisEngineController)
aController).removeMessageOrigin(casReferenceId);
- }
- aController.dropStats(casReferenceId, aController.getName());
- } catch (Exception e) {
- // Throwing this CAS away, ignore exception
- } finally {
- if (aController.isTopLevelComponent()) {
- aController.dropCAS(casReferenceId, true);
- }
+ CasStateEntry casStateEntry =
aController.getLocalCache().lookupEntry(casReferenceId);
+ // Cleanup if the CAS has no children. If it does, the cleanup
will be done when all
+ // child CASes are processed.
+ if ( casStateEntry != null &&
casStateEntry.getSubordinateCasInPlayCount() == 0) {
+ // Cleanup resources associated with a CAS and then release the CAS
+ try {
+ if (aController instanceof AggregateAnalysisEngineController) {
+ ((AggregateAnalysisEngineController)
aController).dropFlow(casReferenceId, true);
+ ((AggregateAnalysisEngineController)
aController).removeMessageOrigin(casReferenceId);
+ }
+ aController.dropStats(casReferenceId, aController.getName());
+ } catch (Exception e) {
+ // Throwing this CAS away, ignore exception
+ } finally {
+ if (aController.isTopLevelComponent()) {
+ aController.dropCAS(casReferenceId, true);
+ }
+ }
}
}