You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/09/02 17:23:10 UTC
svn commit: r810558 [1/3] - in
/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error:
./ handler/
Author: cwiklik
Date: Wed Sep 2 15:23:08 2009
New Revision: 810558
URL: http://svn.apache.org/viewvc?rev=810558&view=rev
Log:
UIMA-1541 Reformatted to conform to UIMA formatting guidelines. No other changes included.
Modified:
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/AsynchAEException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/EndpointThresholds.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorContext.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerBase.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerChain.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListener.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListenerBase.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResult.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultBaseImpl.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPath.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPathImpl.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDs.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDsImpl.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ExpiredMessageException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/InvalidMessageException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/MessageTimeoutException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ServiceShutdownException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASCollectionProcessCompleteTimeout.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASMetaRequestTimeout.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASPingTimeout.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASProcessCasTimeout.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaAsDelegateException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaEEServiceException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UnknownDestinationException.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AnalysisEngineProcessExceptionHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AsynchAEExceptionHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/CpcErrorHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultDelegateErrorHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultExpiredMessageHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultTimeoutHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/GetMetaErrorHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/UnknownDestinationHandler.java
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/AsynchAEException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/AsynchAEException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/AsynchAEException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/AsynchAEException.java Wed Sep 2 15:23:08 2009
@@ -19,31 +19,25 @@
package org.apache.uima.aae.error;
-public class AsynchAEException extends Exception
-{
-
- public AsynchAEException()
- {
- // TODO Auto-generated constructor stub
- }
-
- public AsynchAEException(String message)
- {
- super(message);
- // TODO Auto-generated constructor stub
- }
-
- public AsynchAEException(Throwable cause)
- {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-
- public AsynchAEException(String message, Throwable cause)
- {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
+public class AsynchAEException extends Exception {
+ public AsynchAEException() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public AsynchAEException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public AsynchAEException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public AsynchAEException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/EndpointThresholds.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/EndpointThresholds.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/EndpointThresholds.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/EndpointThresholds.java Wed Sep 2 15:23:08 2009
@@ -22,38 +22,31 @@
import java.util.Iterator;
import java.util.Map;
-public class EndpointThresholds
-{
- private Map thresholdMap;
-
- public EndpointThresholds( Map aThresholdMap )
- {
- thresholdMap = aThresholdMap;
- }
-
- public Iterator getIterator()
- {
- if ( thresholdMap != null )
- {
- return thresholdMap.keySet().iterator();
- }
- return null;
- }
-
- public Threshold getThreshold( Object key )
- {
- if ( thresholdMap.containsKey(key))
- {
- return (Threshold)thresholdMap.get(key);
- }
- return null;
- }
- public void addThreshold( Object key, Threshold aThreshold )
- {
- if ( !thresholdMap.containsKey(key) )
- {
- thresholdMap.put(key, aThreshold);
- }
- }
+public class EndpointThresholds {
+ private Map thresholdMap;
+
+ public EndpointThresholds(Map aThresholdMap) {
+ thresholdMap = aThresholdMap;
+ }
+
+ public Iterator getIterator() {
+ if (thresholdMap != null) {
+ return thresholdMap.keySet().iterator();
+ }
+ return null;
+ }
+
+ public Threshold getThreshold(Object key) {
+ if (thresholdMap.containsKey(key)) {
+ return (Threshold) thresholdMap.get(key);
+ }
+ return null;
+ }
+
+ public void addThreshold(Object key, Threshold aThreshold) {
+ if (!thresholdMap.containsKey(key)) {
+ thresholdMap.put(key, aThreshold);
+ }
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorContext.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorContext.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorContext.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorContext.java Wed Sep 2 15:23:08 2009
@@ -22,45 +22,45 @@
import java.util.HashMap;
import java.util.Iterator;
-public class ErrorContext
-{
- public static final String THROWABLE_ERROR="ThrowableError";
- private boolean handleSilently = false;
-
- private HashMap contextMap = new HashMap();
-
- public void add( HashMap aCtx)
- {
- contextMap.putAll(aCtx);
- }
- public void add( Object key, Object value )
- {
- contextMap.put(key, value);
- }
-
- public void handleSilently(boolean silent ) {
- handleSilently = silent;
- }
- public boolean silentHandling() {
- return handleSilently;
- }
- public Object get( String key )
- {
- if ( contextMap.containsKey(key))
- {
- return contextMap.get(key);
- }
- return null;
- }
- public boolean containsKey( String key )
- {
- return contextMap.containsKey(key);
- }
- public Iterator getIterator()
- {
- return contextMap.keySet().iterator();
- }
- public void remove(String key) {
- contextMap.remove(key);
- }
+public class ErrorContext {
+ public static final String THROWABLE_ERROR = "ThrowableError";
+
+ private boolean handleSilently = false;
+
+ private HashMap contextMap = new HashMap();
+
+ public void add(HashMap aCtx) {
+ contextMap.putAll(aCtx);
+ }
+
+ public void add(Object key, Object value) {
+ contextMap.put(key, value);
+ }
+
+ public void handleSilently(boolean silent) {
+ handleSilently = silent;
+ }
+
+ public boolean silentHandling() {
+ return handleSilently;
+ }
+
+ public Object get(String key) {
+ if (contextMap.containsKey(key)) {
+ return contextMap.get(key);
+ }
+ return null;
+ }
+
+ public boolean containsKey(String key) {
+ return contextMap.containsKey(key);
+ }
+
+ public Iterator getIterator() {
+ return contextMap.keySet().iterator();
+ }
+
+ public void remove(String key) {
+ contextMap.remove(key);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandler.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandler.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandler.java Wed Sep 2 15:23:08 2009
@@ -23,19 +23,26 @@
import org.apache.uima.aae.controller.AnalysisEngineController;
-public interface ErrorHandler
-{
- public static final String CONTINUE = "Continue";
- public static final String RETRY = "Retry";
- public static final String DROPCAS = "DropCas";
- public static final String TERMINATE = "Terminate";
- public static final String DISABLE = "Disable";
- public static final String ENABLE = "Enable";
- public static final String PROPAGATE = "Propagate";
-
- public static final String RETRY_COUNT = "RetryCount";
-
- public boolean handleError( Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController);
- public Map getEndpointThresholdMap();
-
+public interface ErrorHandler {
+ public static final String CONTINUE = "Continue";
+
+ public static final String RETRY = "Retry";
+
+ public static final String DROPCAS = "DropCas";
+
+ public static final String TERMINATE = "Terminate";
+
+ public static final String DISABLE = "Disable";
+
+ public static final String ENABLE = "Enable";
+
+ public static final String PROPAGATE = "Propagate";
+
+ public static final String RETRY_COUNT = "RetryCount";
+
+ public boolean handleError(Throwable t, ErrorContext anErrorContext,
+ AnalysisEngineController aController);
+
+ public Map getEndpointThresholdMap();
+
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerBase.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerBase.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerBase.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerBase.java Wed Sep 2 15:23:08 2009
@@ -35,268 +35,243 @@
import org.apache.uima.aae.monitor.statistics.Statistic;
import org.apache.uima.util.Level;
-public abstract class ErrorHandlerBase
-{
- private static final Class CLASS_NAME = ErrorHandlerBase.class;
-
- protected Map endpointThresholdMap;
-
- public ErrorHandlerBase(Map anEndpointThreasholdMap)
- {
- endpointThresholdMap = anEndpointThreasholdMap;
- }
- public ErrorHandlerBase()
- {
- endpointThresholdMap = new HashMap();
- }
- public Map getEndpointThresholdMap()
- {
- return endpointThresholdMap;
- }
- protected String getAction(String aThresholdToCheck, String endpoint)
- {
- Threshold threshold = getThreshold(aThresholdToCheck, endpoint);
- if (threshold != null )
- {
- return threshold.getAction();
- }
- return null;
- }
-
- protected String getDelegateKey( Endpoint anEndpoint, AnalysisEngineController aController )
- {
- String key = null;
- if ( aController instanceof PrimitiveAnalysisEngineController && aController.isTopLevelComponent())
- {
- key = aController.getServiceEndpointName();
- }
- else if ( anEndpoint != null )
- {
- key = anEndpoint.getEndpoint();
-
- }
- return key;
-
- }
- protected boolean isValidActionForController( String anAction, AnalysisEngineController aController )
- {
- if ( aController instanceof PrimitiveAnalysisEngineController )
- {
- if ( ErrorHandler.DISABLE.equalsIgnoreCase(anAction))
- {
- return false;
- }
- }
- return true;
- }
- protected Threshold getThreshold( String aThresholdToCheck, String endpoint )
- {
- if (endpointThresholdMap.containsKey(endpoint))
- {
- EndpointThresholds endpointThresholds = (EndpointThresholds) endpointThresholdMap.get(endpoint);
- Threshold threshold = endpointThresholds.getThreshold(aThresholdToCheck);
- return threshold;
- }
- return null;
- }
- protected boolean exceedsThreshold(String aThresholdToCheck, String endpoint, AnalysisEngineController controller)
- {
- Threshold threshold = getThreshold(aThresholdToCheck, endpoint);
- if (threshold != null )
- {
- Monitor monitor = controller.getMonitor();
- Statistic statistic = null;
- if ((statistic = monitor.getStatistic(endpoint, aThresholdToCheck)) == null)
- {
- statistic = new LongNumericStatistic(aThresholdToCheck);
- monitor.addStatistic(endpoint, statistic);
- }
- if ( statistic instanceof LongNumericStatistic)
- {
- ((LongNumericStatistic)statistic).increment();
- if (threshold.exceeded(((LongNumericStatistic)statistic).getValue()))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- protected boolean exceedsThreshold(Threshold aThreshold, String aThresholdToCheck, String endpoint, AnalysisEngineController controller)
- {
- if (aThreshold != null )
- {
- Monitor monitor = controller.getMonitor();
- Statistic statistic = null;
-
- if ((statistic = monitor.getStatistic(endpoint, aThresholdToCheck)) == null)
- {
- statistic = new LongNumericStatistic(aThresholdToCheck);
- monitor.addStatistic(endpoint, statistic);
- }
- if ( Monitor.GetMetaErrorRetryCount.equals(aThresholdToCheck) || Monitor.ProcessErrorRetryCount.equals(aThresholdToCheck))
- {
- return aThreshold.maxRetriesExceeded(((LongNumericStatistic)statistic).getValue());
- }
- else
- {
- return aThreshold.exceeded(((LongNumericStatistic)statistic).getValue());
- }
- }
- return false;
- }
-
-
-
- protected String getEndpointName( AnalysisEngineController aController, ErrorContext anErrorContext )
- {
- String key = null;
- if ( aController instanceof PrimitiveAnalysisEngineController )
- {
- key = aController.getServiceEndpointName();
- }
- else
- {
- Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
- key = endpoint.getEndpoint();
- }
-
- return key;
-
- }
-
- protected boolean isHandlerForError( ErrorContext anErrorContext, int anExpectedCommand )
- {
- if ( anErrorContext != null )
- {
- int command = (Integer) anErrorContext.get(AsynchAEMessage.Command);
- return (command == anExpectedCommand) ? true : false;
- }
- return false;
- }
-
- protected boolean shouldRetry( Threshold aThreshold, String aKindOfRetryCount, String aKey, AnalysisEngineController aController)
- {
- return (exceedsThreshold(aThreshold, aKindOfRetryCount, aKey, aController) == true) ? false : true;
- }
-
- protected Threshold getThreshold( Endpoint anEndpoint, Map aDelegateMap, AnalysisEngineController aController )
- {
- Threshold threshold = null;
- if ( aController instanceof AggregateAnalysisEngineController && anEndpoint != null )
- {
- String key = ((AggregateAnalysisEngineController)aController).lookUpDelegateKey(anEndpoint.getEndpoint());
- if ( aDelegateMap.containsKey(key))
- {
- threshold = (Threshold)aDelegateMap.get(key);
- }
- }
- return threshold;
- }
- protected synchronized void incrementStatistic(Monitor aMonitor, String aComponentName, String aStatistic)
- {
- Statistic statistic = aMonitor.getStatistic(aComponentName, aStatistic);
- if ( statistic == null )
- {
- statistic = new LongNumericStatistic(aStatistic);
- aMonitor.addStatistic(aComponentName, statistic);
- }
-
- if (statistic instanceof LongNumericStatistic)
- {
- ((LongNumericStatistic) statistic).increment();
- }
- }
- protected boolean retryLastCommand(int aRetryCommand, Endpoint anEndpoint, AnalysisEngineController aController, String aKey, Threshold aThreshold, ErrorContext anErrorContext)
- {
- boolean done = false;
- String errorCounterKind = (aRetryCommand == AsynchAEMessage.GetMeta ) ? Monitor.GetMetaErrorRetryCount : Monitor.ProcessErrorRetryCount;
- // Handle errors in a loop. Retry until retry threshold is reached
- int retryCount=0;
- while(!done )
- {
-/*
- if ( !exceedsThreshold(aThreshold, errorCounterKind, aKey, aController))
- {
- // Increment number of retries
- incrementStatistic(aController.getMonitor(), aKey, errorCounterKind );
- }
-*/
- // Check if exceeding threshold
- if ( shouldRetry(aThreshold, errorCounterKind, aKey, aController))
- {
- incrementStatistic(aController.getMonitor(), aKey, errorCounterKind );
- try
- {
- switch( aRetryCommand )
- {
- case AsynchAEMessage.GetMeta:
- System.out.println("Controller:"+aController.getComponentName()+" >>>>>>>>>> Retrying GetMeta");
- // Retry GetMeta
- ((AggregateAnalysisEngineController)aController).retryMetadataRequest(anEndpoint);
- break;
-
- case AsynchAEMessage.Process:
- String casReferenceId = (String) anErrorContext.get(AsynchAEMessage.CasReference);
- System.out.println("Controller:"+aController.getComponentName()+" >>>>>>>>>> Retrying Process For Cas Id:"+casReferenceId);
- ((AggregateAnalysisEngineController)aController).retryProcessCASRequest(casReferenceId, anEndpoint, true);
- break;
- }
- return true;
- }
- catch( Exception e)
- {
- anEndpoint.cancelTimer();
- e.printStackTrace();
+public abstract class ErrorHandlerBase {
+ private static final Class CLASS_NAME = ErrorHandlerBase.class;
+
+ protected Map endpointThresholdMap;
+
+ public ErrorHandlerBase(Map anEndpointThreasholdMap) {
+ endpointThresholdMap = anEndpointThreasholdMap;
+ }
+
+ public ErrorHandlerBase() {
+ endpointThresholdMap = new HashMap();
+ }
+
+ public Map getEndpointThresholdMap() {
+ return endpointThresholdMap;
+ }
+
+ protected String getAction(String aThresholdToCheck, String endpoint) {
+ Threshold threshold = getThreshold(aThresholdToCheck, endpoint);
+ if (threshold != null) {
+ return threshold.getAction();
+ }
+ return null;
+ }
+
+ protected String getDelegateKey(Endpoint anEndpoint, AnalysisEngineController aController) {
+ String key = null;
+ if (aController instanceof PrimitiveAnalysisEngineController
+ && aController.isTopLevelComponent()) {
+ key = aController.getServiceEndpointName();
+ } else if (anEndpoint != null) {
+ key = anEndpoint.getEndpoint();
+
+ }
+ return key;
+
+ }
+
+ protected boolean isValidActionForController(String anAction, AnalysisEngineController aController) {
+ if (aController instanceof PrimitiveAnalysisEngineController) {
+ if (ErrorHandler.DISABLE.equalsIgnoreCase(anAction)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected Threshold getThreshold(String aThresholdToCheck, String endpoint) {
+ if (endpointThresholdMap.containsKey(endpoint)) {
+ EndpointThresholds endpointThresholds = (EndpointThresholds) endpointThresholdMap
+ .get(endpoint);
+ Threshold threshold = endpointThresholds.getThreshold(aThresholdToCheck);
+ return threshold;
+ }
+ return null;
+ }
+
+ protected boolean exceedsThreshold(String aThresholdToCheck, String endpoint,
+ AnalysisEngineController controller) {
+ Threshold threshold = getThreshold(aThresholdToCheck, endpoint);
+ if (threshold != null) {
+ Monitor monitor = controller.getMonitor();
+ Statistic statistic = null;
+ if ((statistic = monitor.getStatistic(endpoint, aThresholdToCheck)) == null) {
+ statistic = new LongNumericStatistic(aThresholdToCheck);
+ monitor.addStatistic(endpoint, statistic);
+ }
+ if (statistic instanceof LongNumericStatistic) {
+ ((LongNumericStatistic) statistic).increment();
+ if (threshold.exceeded(((LongNumericStatistic) statistic).getValue())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected boolean exceedsThreshold(Threshold aThreshold, String aThresholdToCheck,
+ String endpoint, AnalysisEngineController controller) {
+ if (aThreshold != null) {
+ Monitor monitor = controller.getMonitor();
+ Statistic statistic = null;
+
+ if ((statistic = monitor.getStatistic(endpoint, aThresholdToCheck)) == null) {
+ statistic = new LongNumericStatistic(aThresholdToCheck);
+ monitor.addStatistic(endpoint, statistic);
+ }
+ if (Monitor.GetMetaErrorRetryCount.equals(aThresholdToCheck)
+ || Monitor.ProcessErrorRetryCount.equals(aThresholdToCheck)) {
+ return aThreshold.maxRetriesExceeded(((LongNumericStatistic) statistic).getValue());
+ } else {
+ return aThreshold.exceeded(((LongNumericStatistic) statistic).getValue());
+ }
+ }
+ return false;
+ }
+
+ protected String getEndpointName(AnalysisEngineController aController, ErrorContext anErrorContext) {
+ String key = null;
+ if (aController instanceof PrimitiveAnalysisEngineController) {
+ key = aController.getServiceEndpointName();
+ } else {
+ Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
+ key = endpoint.getEndpoint();
+ }
+
+ return key;
+
+ }
+
+ protected boolean isHandlerForError(ErrorContext anErrorContext, int anExpectedCommand) {
+ if (anErrorContext != null) {
+ int command = (Integer) anErrorContext.get(AsynchAEMessage.Command);
+ return (command == anExpectedCommand) ? true : false;
+ }
+ return false;
+ }
+
+ protected boolean shouldRetry(Threshold aThreshold, String aKindOfRetryCount, String aKey,
+ AnalysisEngineController aController) {
+ return (exceedsThreshold(aThreshold, aKindOfRetryCount, aKey, aController) == true) ? false
+ : true;
+ }
+
+ protected Threshold getThreshold(Endpoint anEndpoint, Map aDelegateMap,
+ AnalysisEngineController aController) {
+ Threshold threshold = null;
+ if (aController instanceof AggregateAnalysisEngineController && anEndpoint != null) {
+ String key = ((AggregateAnalysisEngineController) aController).lookUpDelegateKey(anEndpoint
+ .getEndpoint());
+ if (aDelegateMap.containsKey(key)) {
+ threshold = (Threshold) aDelegateMap.get(key);
+ }
+ }
+ return threshold;
+ }
+
+ protected synchronized void incrementStatistic(Monitor aMonitor, String aComponentName,
+ String aStatistic) {
+ Statistic statistic = aMonitor.getStatistic(aComponentName, aStatistic);
+ if (statistic == null) {
+ statistic = new LongNumericStatistic(aStatistic);
+ aMonitor.addStatistic(aComponentName, statistic);
+ }
+
+ if (statistic instanceof LongNumericStatistic) {
+ ((LongNumericStatistic) statistic).increment();
+ }
+ }
+
+ protected boolean retryLastCommand(int aRetryCommand, Endpoint anEndpoint,
+ AnalysisEngineController aController, String aKey, Threshold aThreshold,
+ ErrorContext anErrorContext) {
+ boolean done = false;
+ String errorCounterKind = (aRetryCommand == AsynchAEMessage.GetMeta) ? Monitor.GetMetaErrorRetryCount
+ : Monitor.ProcessErrorRetryCount;
+ // Handle errors in a loop. Retry until retry threshold is reached
+ int retryCount = 0;
+ while (!done) {
+ /*
+ * if ( !exceedsThreshold(aThreshold, errorCounterKind, aKey, aController)) { // Increment
+ * number of retries incrementStatistic(aController.getMonitor(), aKey, errorCounterKind ); }
+ */
+ // Check if exceeding threshold
+ if (shouldRetry(aThreshold, errorCounterKind, aKey, aController)) {
+ incrementStatistic(aController.getMonitor(), aKey, errorCounterKind);
+ try {
+ switch (aRetryCommand) {
+ case AsynchAEMessage.GetMeta:
+ System.out.println("Controller:" + aController.getComponentName()
+ + " >>>>>>>>>> Retrying GetMeta");
+ // Retry GetMeta
+ ((AggregateAnalysisEngineController) aController).retryMetadataRequest(anEndpoint);
+ break;
+
+ case AsynchAEMessage.Process:
+ String casReferenceId = (String) anErrorContext.get(AsynchAEMessage.CasReference);
+ System.out.println("Controller:" + aController.getComponentName()
+ + " >>>>>>>>>> Retrying Process For Cas Id:" + casReferenceId);
+ ((AggregateAnalysisEngineController) aController).retryProcessCASRequest(
+ casReferenceId, anEndpoint, true);
+ break;
+ }
+ return true;
+ } catch (Exception e) {
+ anEndpoint.cancelTimer();
+ e.printStackTrace();
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "retryLastCommand", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", new Object[] { e });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
+ "retryLastCommand", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_exception__WARNING", new Object[] { e });
}
- }
- }
- else
- {
- done = true;
- }
- }
- return false;
- }
- protected synchronized boolean exceedsThresholdWithinWindow(Monitor aMonitor, String aStat, String aComponent, Threshold aThreshold)
- {
- LongNumericStatistic currentErrorCountStat = aMonitor.getLongNumericStatistic(aComponent, aStat);
- LongNumericStatistic currentProcessCountStat = aMonitor.getLongNumericStatistic(aComponent, Monitor.ProcessCount);
- long numberOfErrors = currentErrorCountStat.getValue();
- // Check if threshold exceeded
- if (numberOfErrors > 0 && aThreshold.getThreshold() > 0 && numberOfErrors % aThreshold.getThreshold() == 0)
- {
- return true;
- }
- // Check if reached end of window. If so, begin counting against a new window
- if (aThreshold.getThreshold() > 0 && aThreshold.getWindow() > 0 && currentProcessCountStat.getValue() % aThreshold.getWindow() == 0)
- {
- aMonitor.resetCountingStatistic(aComponent, aStat);
- }
- return false;
- }
- protected boolean continueOnError(String aDelegateKey, Threshold aThreshold, String aCasReferenceId, Throwable t, AnalysisEngineController aController)
- {
- try
- {
- if ( aThreshold.getContinueOnRetryFailure() == true &&
- ((AggregateAnalysisEngineController) aController).continueOnError(aCasReferenceId, aDelegateKey, (Exception) t))
- {
- return true;
- }
- }
- catch ( Exception e)
- {
+ }
+ } else {
+ done = true;
+ }
+ }
+ return false;
+ }
+
+ protected synchronized boolean exceedsThresholdWithinWindow(Monitor aMonitor, String aStat,
+ String aComponent, Threshold aThreshold) {
+ LongNumericStatistic currentErrorCountStat = aMonitor
+ .getLongNumericStatistic(aComponent, aStat);
+ LongNumericStatistic currentProcessCountStat = aMonitor.getLongNumericStatistic(aComponent,
+ Monitor.ProcessCount);
+ long numberOfErrors = currentErrorCountStat.getValue();
+ // Check if threshold exceeded
+ if (numberOfErrors > 0 && aThreshold.getThreshold() > 0
+ && numberOfErrors % aThreshold.getThreshold() == 0) {
+ return true;
+ }
+ // Check if reached end of window. If so, begin counting against a new window
+ if (aThreshold.getThreshold() > 0 && aThreshold.getWindow() > 0
+ && currentProcessCountStat.getValue() % aThreshold.getWindow() == 0) {
+ aMonitor.resetCountingStatistic(aComponent, aStat);
+ }
+ return false;
+ }
+
+ protected boolean continueOnError(String aDelegateKey, Threshold aThreshold,
+ String aCasReferenceId, Throwable t, AnalysisEngineController aController) {
+ try {
+ if (aThreshold.getContinueOnRetryFailure() == true
+ && ((AggregateAnalysisEngineController) aController).continueOnError(aCasReferenceId,
+ aDelegateKey, (Exception) t)) {
+ return true;
+ }
+ } catch (Exception e) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "continueOnError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", e); //new Object[] { e });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
+ "continueOnError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_exception__WARNING", e); // new Object[] { e });
}
- }
- return false;
- }
+ }
+ return false;
+ }
-
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerChain.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerChain.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerChain.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerChain.java Wed Sep 2 15:23:08 2009
@@ -27,43 +27,36 @@
import org.apache.uima.aae.controller.AnalysisEngineController;
-public class ErrorHandlerChain extends LinkedList
-{
- public ErrorHandlerChain( List aChainofHandlers )
- {
- this.addAll(aChainofHandlers);
- }
-
- public Map getThresholds()
- {
- Map thresholds = new HashMap();
- Iterator iterator = this.iterator();
- while( iterator.hasNext() )
- {
- ErrorHandler handler = ((ErrorHandler)iterator.next());
- Map thresholdMap = handler.getEndpointThresholdMap();
- // merge
- thresholds.putAll(thresholdMap);
- }
- return thresholds;
- }
- public void handle( Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController )
- {
- boolean errorHandled = false;
- if ( size() > 0)
- {
- Throwable cause = t;
- if ( t instanceof AsynchAEException && t.getCause() != null )
- {
- cause = t.getCause();
- }
- Iterator iterator = this.iterator();
- while( errorHandled == false && iterator.hasNext() )
- {
- ErrorHandler handler = ((ErrorHandler)iterator.next());
- errorHandled = handler.handleError( cause, anErrorContext, aController );
- }
- }
- }
+public class ErrorHandlerChain extends LinkedList {
+ public ErrorHandlerChain(List aChainofHandlers) {
+ this.addAll(aChainofHandlers);
+ }
+
+ public Map getThresholds() {
+ Map thresholds = new HashMap();
+ Iterator iterator = this.iterator();
+ while (iterator.hasNext()) {
+ ErrorHandler handler = ((ErrorHandler) iterator.next());
+ Map thresholdMap = handler.getEndpointThresholdMap();
+ // merge
+ thresholds.putAll(thresholdMap);
+ }
+ return thresholds;
+ }
+
+ public void handle(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController) {
+ boolean errorHandled = false;
+ if (size() > 0) {
+ Throwable cause = t;
+ if (t instanceof AsynchAEException && t.getCause() != null) {
+ cause = t.getCause();
+ }
+ Iterator iterator = this.iterator();
+ while (errorHandled == false && iterator.hasNext()) {
+ ErrorHandler handler = ((ErrorHandler) iterator.next());
+ errorHandled = handler.handleError(cause, anErrorContext, aController);
+ }
+ }
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListener.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListener.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListener.java Wed Sep 2 15:23:08 2009
@@ -21,9 +21,8 @@
import org.apache.uima.aae.controller.AnalysisEngineController;
-public interface ErrorHandlerListener
-{
- public void onError( Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController );
+public interface ErrorHandlerListener {
+ public void onError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController);
- public void onError( Throwable t, ErrorContext anErrorContext);
+ public void onError(Throwable t, ErrorContext anErrorContext);
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListenerBase.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListenerBase.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListenerBase.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorHandlerListenerBase.java Wed Sep 2 15:23:08 2009
@@ -21,22 +21,18 @@
import org.apache.uima.aae.controller.AnalysisEngineController;
-public class ErrorHandlerListenerBase implements ErrorHandlerListener
-{
- private ErrorHandlerChain handlerChain;
-
-
- public void setErrorHandlerChain( ErrorHandlerChain aChainOfErrorHandlers)
- {
- handlerChain = aChainOfErrorHandlers;
- }
- public void onError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController)
- {
- handlerChain.handle( t, anErrorContext, aController);
- }
+public class ErrorHandlerListenerBase implements ErrorHandlerListener {
+ private ErrorHandlerChain handlerChain;
- public void onError(Throwable t, ErrorContext anErrorContext)
- {
+ public void setErrorHandlerChain(ErrorHandlerChain aChainOfErrorHandlers) {
+ handlerChain = aChainOfErrorHandlers;
+ }
+
+ public void onError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController) {
+ handlerChain.handle(t, anErrorContext, aController);
+ }
+
+ public void onError(Throwable t, ErrorContext anErrorContext) {
}
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResult.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResult.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResult.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResult.java Wed Sep 2 15:23:08 2009
@@ -23,43 +23,50 @@
import org.apache.uima.aae.error.ErrorResultTDs.TD;
-public interface ErrorResult extends Serializable
-{
- public void setRootCause( Throwable aRootCause );
-
- public void addComponentKeyPath( String aComponentKeyPath );
-
- public void addComponentKeyPath(String aComponentKeyPath, boolean terminated, boolean disabled);
-
- public void setTerminated();
-
- public void setDisabled();
-
- /**
- * Returns the underlying root cause first reported as an error
- * @return Throwable
- */
- public Throwable getRootCause();
- /**
- * Returns a path consisting of a list of component key names
- * @return
- */
- public ErrorResultComponentPath getComponentKeyPath();
- /**
- * Returns true is any termination occurred with this error
- * @return
- */
- public boolean wasTerminated();
- /**
- * Returns true if any disabling occured with this error
- * @return
- */
- public boolean wasDisabled();
- /**
- * Returns a collection of paths to the components that were terminated or disabled
- *
- * @return
- */
- public ErrorResultTDs getTDs();
-
+public interface ErrorResult extends Serializable {
+ public void setRootCause(Throwable aRootCause);
+
+ public void addComponentKeyPath(String aComponentKeyPath);
+
+ public void addComponentKeyPath(String aComponentKeyPath, boolean terminated, boolean disabled);
+
+ public void setTerminated();
+
+ public void setDisabled();
+
+ /**
+ * Returns the underlying root cause first reported as an error
+ *
+ * @return Throwable
+ */
+ public Throwable getRootCause();
+
+ /**
+ * Returns a path consisting of a list of component key names
+ *
+ * @return
+ */
+ public ErrorResultComponentPath getComponentKeyPath();
+
+ /**
+ * Returns true is any termination occurred with this error
+ *
+ * @return
+ */
+ public boolean wasTerminated();
+
+ /**
+ * Returns true if any disabling occured with this error
+ *
+ * @return
+ */
+ public boolean wasDisabled();
+
+ /**
+ * Returns a collection of paths to the components that were terminated or disabled
+ *
+ * @return
+ */
+ public ErrorResultTDs getTDs();
+
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultBaseImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultBaseImpl.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultBaseImpl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultBaseImpl.java Wed Sep 2 15:23:08 2009
@@ -29,142 +29,146 @@
import org.apache.uima.aae.error.ErrorResultTDs.TD;
import org.apache.uima.aae.error.ErrorResultTDsImpl.TDImpl;
-public class ErrorResultBaseImpl implements ErrorResult
-{
- private static final long serialVersionUID = -964940732231472225L;
-
- private ErrorResultComponentPath resultPath =
- new ErrorResultComponentPathImpl();
- private ErrorResultTDs resultTDs =
- new ErrorResultTDsImpl();
-
- private boolean wasTerminated = false;
- private boolean wasDisabled = false;
- private Throwable rootCause;
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#addComponentKeyPath(java.lang.String)
- */
- public void addComponentKeyPath( String aComponentKeyPath )
- {
- addComponentKeyPath( aComponentKeyPath, false, false);
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#addComponentKeyPath(java.lang.String)
- */
- public void addComponentKeyPath(String aComponentKeyPath, boolean terminated, boolean disabled)
- {
- resultPath.add(aComponentKeyPath, 0);
- wasTerminated = terminated;
- wasDisabled = disabled;
- if ( wasTerminated || wasDisabled )
- {
- TD td = new TDImpl(aComponentKeyPath, wasTerminated, wasDisabled );
- resultTDs.add(td);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#getComponentKeyPath()
- */
- public ErrorResultComponentPath getComponentKeyPath()
- {
- return resultPath;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#getRootCause()
- */
- public Throwable getRootCause()
- {
- return rootCause;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#getTDs()
- */
- public ErrorResultTDs getTDs()
- {
- return resultTDs;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#setDisabled()
- */
- public void setDisabled()
- {
- wasDisabled = true;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#setRootCause(java.lang.Throwable)
- */
- public void setRootCause(Throwable aThrowable)
- {
- Throwable t = aThrowable, prev = null;
- while( (t = t.getCause()) != null )
- {
- prev = t;
- }
- rootCause = ( prev == null )? aThrowable : prev;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#setTerminated()
- */
- public void setTerminated()
- {
- wasTerminated = true;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#wasDisabled()
- */
- public boolean wasDisabled()
- {
- return wasDisabled;
- }
-
- /* (non-Javadoc)
- * @see org.apache.uima.aae.error.ErrorResult#wasTerminated()
- */
- public boolean wasTerminated()
- {
- return wasTerminated;
- }
-
- public static void main( String[] args )
- {
- ErrorResultBaseImpl errorResult = new ErrorResultBaseImpl();
-
- errorResult.setRootCause(new AsynchAEException(new NullPointerException()));
- errorResult.addComponentKeyPath("InnerMostLevel");
- errorResult.addComponentKeyPath("InnerLevel", true, false);
- errorResult.addComponentKeyPath("TopLevel");
-
- System.out.println("Root Cause:"+errorResult.getRootCause());
- ErrorResultComponentPath ercp = errorResult.getComponentKeyPath();
- Iterator it = ercp.iterator();
- int inx=1;
- while( it.hasNext())
- {
- System.out.print((String)it.next());
- System.out.println("");
-
- for( int i=0;i<inx; i++ )
- {
- System.out.print("\t");
- }
- inx++;
- }
- System.out.println("");
-
- ErrorResultTDs tds = errorResult.getTDs();
- Iterator it2 = tds.iterator();
- while( it2.hasNext())
- {
- System.out.println( ((TD)it2.next()).gatPath());
- }
- }
+public class ErrorResultBaseImpl implements ErrorResult {
+ private static final long serialVersionUID = -964940732231472225L;
+
+ private ErrorResultComponentPath resultPath = new ErrorResultComponentPathImpl();
+
+ private ErrorResultTDs resultTDs = new ErrorResultTDsImpl();
+
+ private boolean wasTerminated = false;
+
+ private boolean wasDisabled = false;
+
+ private Throwable rootCause;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#addComponentKeyPath(java.lang.String)
+ */
+ public void addComponentKeyPath(String aComponentKeyPath) {
+ addComponentKeyPath(aComponentKeyPath, false, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#addComponentKeyPath(java.lang.String)
+ */
+ public void addComponentKeyPath(String aComponentKeyPath, boolean terminated, boolean disabled) {
+ resultPath.add(aComponentKeyPath, 0);
+ wasTerminated = terminated;
+ wasDisabled = disabled;
+ if (wasTerminated || wasDisabled) {
+ TD td = new TDImpl(aComponentKeyPath, wasTerminated, wasDisabled);
+ resultTDs.add(td);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#getComponentKeyPath()
+ */
+ public ErrorResultComponentPath getComponentKeyPath() {
+ return resultPath;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#getRootCause()
+ */
+ public Throwable getRootCause() {
+ return rootCause;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#getTDs()
+ */
+ public ErrorResultTDs getTDs() {
+ return resultTDs;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#setDisabled()
+ */
+ public void setDisabled() {
+ wasDisabled = true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#setRootCause(java.lang.Throwable)
+ */
+ public void setRootCause(Throwable aThrowable) {
+ Throwable t = aThrowable, prev = null;
+ while ((t = t.getCause()) != null) {
+ prev = t;
+ }
+ rootCause = (prev == null) ? aThrowable : prev;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#setTerminated()
+ */
+ public void setTerminated() {
+ wasTerminated = true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#wasDisabled()
+ */
+ public boolean wasDisabled() {
+ return wasDisabled;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.aae.error.ErrorResult#wasTerminated()
+ */
+ public boolean wasTerminated() {
+ return wasTerminated;
+ }
+
+ public static void main(String[] args) {
+ ErrorResultBaseImpl errorResult = new ErrorResultBaseImpl();
+
+ errorResult.setRootCause(new AsynchAEException(new NullPointerException()));
+ errorResult.addComponentKeyPath("InnerMostLevel");
+ errorResult.addComponentKeyPath("InnerLevel", true, false);
+ errorResult.addComponentKeyPath("TopLevel");
+
+ System.out.println("Root Cause:" + errorResult.getRootCause());
+ ErrorResultComponentPath ercp = errorResult.getComponentKeyPath();
+ Iterator it = ercp.iterator();
+ int inx = 1;
+ while (it.hasNext()) {
+ System.out.print((String) it.next());
+ System.out.println("");
+
+ for (int i = 0; i < inx; i++) {
+ System.out.print("\t");
+ }
+ inx++;
+ }
+ System.out.println("");
+
+ ErrorResultTDs tds = errorResult.getTDs();
+ Iterator it2 = tds.iterator();
+ while (it2.hasNext()) {
+ System.out.println(((TD) it2.next()).gatPath());
+ }
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPath.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPath.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPath.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPath.java Wed Sep 2 15:23:08 2009
@@ -22,11 +22,13 @@
import java.io.Serializable;
import java.util.Iterator;
-public interface ErrorResultComponentPath extends Serializable
-{
- public Iterator iterator();
- public void add( String aPath );
- public void add( String aPath, int anInsertPosition);
- public String get( int aPosition );
-
+public interface ErrorResultComponentPath extends Serializable {
+ public Iterator iterator();
+
+ public void add(String aPath);
+
+ public void add(String aPath, int anInsertPosition);
+
+ public String get(int aPosition);
+
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPathImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPathImpl.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPathImpl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultComponentPathImpl.java Wed Sep 2 15:23:08 2009
@@ -23,33 +23,27 @@
import java.util.Iterator;
import java.util.List;
-public class ErrorResultComponentPathImpl implements ErrorResultComponentPath
-{
- private static final long serialVersionUID = 100262915217554060L;
-
- private List pathList = new ArrayList();
-
- public void add(String aPath)
- {
- this.add(aPath, pathList.size());
- }
-
- public void add(String aPath, int anInsertPosition)
- {
- pathList.add(anInsertPosition, aPath);
- }
-
- public String get(int aPosition)
- {
- if ( aPosition >= 0 && aPosition <= pathList.size())
- {
- return (String)pathList.get(aPosition);
- }
- return null;
- }
-
- public Iterator iterator()
- {
- return pathList.iterator();
- }
+public class ErrorResultComponentPathImpl implements ErrorResultComponentPath {
+ private static final long serialVersionUID = 100262915217554060L;
+
+ private List pathList = new ArrayList();
+
+ public void add(String aPath) {
+ this.add(aPath, pathList.size());
+ }
+
+ public void add(String aPath, int anInsertPosition) {
+ pathList.add(anInsertPosition, aPath);
+ }
+
+ public String get(int aPosition) {
+ if (aPosition >= 0 && aPosition <= pathList.size()) {
+ return (String) pathList.get(aPosition);
+ }
+ return null;
+ }
+
+ public Iterator iterator() {
+ return pathList.iterator();
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDs.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDs.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDs.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDs.java Wed Sep 2 15:23:08 2009
@@ -22,20 +22,25 @@
import java.io.Serializable;
import java.util.Iterator;
-public interface ErrorResultTDs extends Serializable
-{
- public Iterator iterator();
- public void add( TD aTD);
- public void add( TD aTD, int anInsertPosition);
- public TD get(int aPosition);
-
- public interface TD extends Serializable
- {
- public String gatPath();
- public void setTerminated();
- public void setDisabled();
- public boolean wasTerminated();
- public boolean wasDisabled();
- }
-
+public interface ErrorResultTDs extends Serializable {
+ public Iterator iterator();
+
+ public void add(TD aTD);
+
+ public void add(TD aTD, int anInsertPosition);
+
+ public TD get(int aPosition);
+
+ public interface TD extends Serializable {
+ public String gatPath();
+
+ public void setTerminated();
+
+ public void setDisabled();
+
+ public boolean wasTerminated();
+
+ public boolean wasDisabled();
+ }
+
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDsImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDsImpl.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDsImpl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ErrorResultTDsImpl.java Wed Sep 2 15:23:08 2009
@@ -23,73 +23,69 @@
import java.util.Iterator;
import java.util.List;
-public class ErrorResultTDsImpl implements ErrorResultTDs
-{
- /**
+public class ErrorResultTDsImpl implements ErrorResultTDs {
+ /**
*
*/
- private static final long serialVersionUID = -5385443370047862288L;
+ private static final long serialVersionUID = -5385443370047862288L;
- private List list = new ArrayList();
- public void add(TD aTD)
- {
- this.add(aTD, 0);
- }
-
- public void add(TD aTD, int anInsertPosition)
- {
- list.add(anInsertPosition, aTD);
- }
-
- public TD get(int aPosition)
- {
- if ( aPosition >= 0 && aPosition <= list.size())
- {
- return (TD)list.get(aPosition);
- }
- return null;
- }
-
- public Iterator iterator()
- {
- return list.iterator();
- }
-
- public static class TDImpl implements TD
- {
- /**
+ private List list = new ArrayList();
+
+ public void add(TD aTD) {
+ this.add(aTD, 0);
+ }
+
+ public void add(TD aTD, int anInsertPosition) {
+ list.add(anInsertPosition, aTD);
+ }
+
+ public TD get(int aPosition) {
+ if (aPosition >= 0 && aPosition <= list.size()) {
+ return (TD) list.get(aPosition);
+ }
+ return null;
+ }
+
+ public Iterator iterator() {
+ return list.iterator();
+ }
+
+ public static class TDImpl implements TD {
+ /**
*
*/
- private static final long serialVersionUID = 2160592875336611921L;
- private String path;
- private boolean wasTerminated;
- private boolean wasDisabled;
-
- public TDImpl( String aPath, boolean terminated, boolean disabled )
- {
- path = aPath;
- wasDisabled = disabled;
- wasTerminated = terminated;
- }
- public String gatPath()
- {
- return path;
- }
- public void setTerminated()
- {
- wasTerminated = true;
- }
- public void setDisabled()
- {
- wasDisabled = true;
- }
- public boolean wasTerminated()
- {
- return wasTerminated;
- }
- public boolean wasDisabled()
- {
- return wasDisabled;
- }
- }
+ private static final long serialVersionUID = 2160592875336611921L;
+
+ private String path;
+
+ private boolean wasTerminated;
+
+ private boolean wasDisabled;
+
+ public TDImpl(String aPath, boolean terminated, boolean disabled) {
+ path = aPath;
+ wasDisabled = disabled;
+ wasTerminated = terminated;
+ }
+
+ public String gatPath() {
+ return path;
+ }
+
+ public void setTerminated() {
+ wasTerminated = true;
+ }
+
+ public void setDisabled() {
+ wasDisabled = true;
+ }
+
+ public boolean wasTerminated() {
+ return wasTerminated;
+ }
+
+ public boolean wasDisabled() {
+ return wasDisabled;
+ }
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ExpiredMessageException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ExpiredMessageException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ExpiredMessageException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ExpiredMessageException.java Wed Sep 2 15:23:08 2009
@@ -19,27 +19,21 @@
package org.apache.uima.aae.error;
-public class ExpiredMessageException extends Exception
-{
- public ExpiredMessageException()
- {
- super();
- }
-
- public ExpiredMessageException(String message)
- {
- super(message);
- }
-
- public ExpiredMessageException(Throwable cause)
- {
- super(cause);
- }
-
- public ExpiredMessageException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
+public class ExpiredMessageException extends Exception {
+ public ExpiredMessageException() {
+ super();
+ }
+
+ public ExpiredMessageException(String message) {
+ super(message);
+ }
+
+ public ExpiredMessageException(Throwable cause) {
+ super(cause);
+ }
+
+ public ExpiredMessageException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/InvalidMessageException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/InvalidMessageException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/InvalidMessageException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/InvalidMessageException.java Wed Sep 2 15:23:08 2009
@@ -19,31 +19,26 @@
package org.apache.uima.aae.error;
-public class InvalidMessageException extends Exception
-{
- /**
+public class InvalidMessageException extends Exception {
+ /**
*
*/
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public InvalidMessageException()
- {
- super();
- }
-
- public InvalidMessageException(String message)
- {
- super(message);
- }
-
- public InvalidMessageException(Throwable cause)
- {
- super(cause);
- }
-
- public InvalidMessageException(String message, Throwable cause)
- {
- super(message, cause);
- }
+ public InvalidMessageException() {
+ super();
+ }
+
+ public InvalidMessageException(String message) {
+ super(message);
+ }
+
+ public InvalidMessageException(Throwable cause) {
+ super(cause);
+ }
+
+ public InvalidMessageException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/MessageTimeoutException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/MessageTimeoutException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/MessageTimeoutException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/MessageTimeoutException.java Wed Sep 2 15:23:08 2009
@@ -19,27 +19,21 @@
package org.apache.uima.aae.error;
-public class MessageTimeoutException extends Exception
-{
- public MessageTimeoutException()
- {
- super();
- }
-
- public MessageTimeoutException(String message)
- {
- super(message);
- }
-
- public MessageTimeoutException(Throwable cause)
- {
- super(cause);
- }
-
- public MessageTimeoutException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
+public class MessageTimeoutException extends Exception {
+ public MessageTimeoutException() {
+ super();
+ }
+
+ public MessageTimeoutException(String message) {
+ super(message);
+ }
+
+ public MessageTimeoutException(Throwable cause) {
+ super(cause);
+ }
+
+ public MessageTimeoutException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ServiceShutdownException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ServiceShutdownException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ServiceShutdownException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/ServiceShutdownException.java Wed Sep 2 15:23:08 2009
@@ -19,6 +19,5 @@
package org.apache.uima.aae.error;
-public class ServiceShutdownException extends Exception
-{
+public class ServiceShutdownException extends Exception {
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASCollectionProcessCompleteTimeout.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASCollectionProcessCompleteTimeout.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASCollectionProcessCompleteTimeout.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASCollectionProcessCompleteTimeout.java Wed Sep 2 15:23:08 2009
@@ -19,25 +19,20 @@
package org.apache.uima.aae.error;
-public class UimaASCollectionProcessCompleteTimeout extends Exception
-{
- public UimaASCollectionProcessCompleteTimeout()
- {
- }
-
- public UimaASCollectionProcessCompleteTimeout(String message)
- {
- super(message);
- }
-
- public UimaASCollectionProcessCompleteTimeout(Throwable cause)
- {
- super(cause);
- }
-
- public UimaASCollectionProcessCompleteTimeout(String message, Throwable cause)
- {
- super(message, cause);
- }
+public class UimaASCollectionProcessCompleteTimeout extends Exception {
+ public UimaASCollectionProcessCompleteTimeout() {
+ }
+
+ public UimaASCollectionProcessCompleteTimeout(String message) {
+ super(message);
+ }
+
+ public UimaASCollectionProcessCompleteTimeout(Throwable cause) {
+ super(cause);
+ }
+
+ public UimaASCollectionProcessCompleteTimeout(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASMetaRequestTimeout.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASMetaRequestTimeout.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASMetaRequestTimeout.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASMetaRequestTimeout.java Wed Sep 2 15:23:08 2009
@@ -19,25 +19,20 @@
package org.apache.uima.aae.error;
-public class UimaASMetaRequestTimeout extends Exception
-{
- public UimaASMetaRequestTimeout()
- {
- }
-
- public UimaASMetaRequestTimeout(String message)
- {
- super(message);
- }
-
- public UimaASMetaRequestTimeout(Throwable cause)
- {
- super(cause);
- }
-
- public UimaASMetaRequestTimeout(String message, Throwable cause)
- {
- super(message, cause);
- }
+public class UimaASMetaRequestTimeout extends Exception {
+ public UimaASMetaRequestTimeout() {
+ }
+
+ public UimaASMetaRequestTimeout(String message) {
+ super(message);
+ }
+
+ public UimaASMetaRequestTimeout(Throwable cause) {
+ super(cause);
+ }
+
+ public UimaASMetaRequestTimeout(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASPingTimeout.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASPingTimeout.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASPingTimeout.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASPingTimeout.java Wed Sep 2 15:23:08 2009
@@ -19,25 +19,20 @@
package org.apache.uima.aae.error;
-public class UimaASPingTimeout extends Exception
-{
- public UimaASPingTimeout()
- {
- }
-
- public UimaASPingTimeout(String message)
- {
- super(message);
- }
-
- public UimaASPingTimeout(Throwable cause)
- {
- super(cause);
- }
-
- public UimaASPingTimeout(String message, Throwable cause)
- {
- super(message, cause);
- }
+public class UimaASPingTimeout extends Exception {
+ public UimaASPingTimeout() {
+ }
+
+ public UimaASPingTimeout(String message) {
+ super(message);
+ }
+
+ public UimaASPingTimeout(Throwable cause) {
+ super(cause);
+ }
+
+ public UimaASPingTimeout(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASProcessCasTimeout.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASProcessCasTimeout.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASProcessCasTimeout.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaASProcessCasTimeout.java Wed Sep 2 15:23:08 2009
@@ -19,25 +19,20 @@
package org.apache.uima.aae.error;
-public class UimaASProcessCasTimeout extends Exception
-{
- public UimaASProcessCasTimeout()
- {
- }
-
- public UimaASProcessCasTimeout(String message)
- {
- super(message);
- }
-
- public UimaASProcessCasTimeout(Throwable cause)
- {
- super(cause);
- }
-
- public UimaASProcessCasTimeout(String message, Throwable cause)
- {
- super(message, cause);
- }
+public class UimaASProcessCasTimeout extends Exception {
+ public UimaASProcessCasTimeout() {
+ }
+
+ public UimaASProcessCasTimeout(String message) {
+ super(message);
+ }
+
+ public UimaASProcessCasTimeout(Throwable cause) {
+ super(cause);
+ }
+
+ public UimaASProcessCasTimeout(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaAsDelegateException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaAsDelegateException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaAsDelegateException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaAsDelegateException.java Wed Sep 2 15:23:08 2009
@@ -18,14 +18,14 @@
*/
package org.apache.uima.aae.error;
-public class UimaAsDelegateException extends Exception {
+public class UimaAsDelegateException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
- public UimaAsDelegateException(String message, Throwable cause)
- {
+
+ public UimaAsDelegateException(String message, Throwable cause) {
super(message, cause);
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaEEServiceException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaEEServiceException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaEEServiceException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UimaEEServiceException.java Wed Sep 2 15:23:08 2009
@@ -19,34 +19,29 @@
package org.apache.uima.aae.error;
-public class UimaEEServiceException extends Exception
-{
- private static final long serialVersionUID = -8476335131285562566L;
+public class UimaEEServiceException extends Exception {
+ private static final long serialVersionUID = -8476335131285562566L;
- /**
+ /**
*
*/
- public UimaEEServiceException()
- {
- // TODO Auto-generated constructor stub
- }
-
- public UimaEEServiceException(String message)
- {
- super(message);
- // TODO Auto-generated constructor stub
- }
-
- public UimaEEServiceException(Throwable cause)
- {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-
- public UimaEEServiceException(String message, Throwable cause)
- {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
+ public UimaEEServiceException() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public UimaEEServiceException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public UimaEEServiceException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public UimaEEServiceException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UnknownDestinationException.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UnknownDestinationException.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UnknownDestinationException.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/UnknownDestinationException.java Wed Sep 2 15:23:08 2009
@@ -19,27 +19,21 @@
package org.apache.uima.aae.error;
-public class UnknownDestinationException extends Exception
-{
- public UnknownDestinationException()
- {
- super();
- }
-
- public UnknownDestinationException(String message)
- {
- super(message);
- }
-
- public UnknownDestinationException(Throwable cause)
- {
- super(cause);
- }
-
- public UnknownDestinationException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
+public class UnknownDestinationException extends Exception {
+ public UnknownDestinationException() {
+ super();
+ }
+
+ public UnknownDestinationException(String message) {
+ super(message);
+ }
+
+ public UnknownDestinationException(Throwable cause) {
+ super(cause);
+ }
+
+ public UnknownDestinationException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AnalysisEngineProcessExceptionHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AnalysisEngineProcessExceptionHandler.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AnalysisEngineProcessExceptionHandler.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AnalysisEngineProcessExceptionHandler.java Wed Sep 2 15:23:08 2009
@@ -33,52 +33,45 @@
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.util.Level;
-public class AnalysisEngineProcessExceptionHandler extends ErrorHandlerBase implements ErrorHandler
-{
- private static final Class CLASS_NAME = AnalysisEngineProcessExceptionHandler.class;
-
- public AnalysisEngineProcessExceptionHandler( Map anEndpointThreasholdMap )
- {
- super(anEndpointThreasholdMap);
- }
- public AnalysisEngineProcessExceptionHandler( )
- {
- }
- public boolean handleError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController)
- {
- if (t instanceof AnalysisEngineProcessException )
- {
- String casReferenceId=null;
- if ( anErrorContext.containsKey(AsynchAEMessage.CasReference ) )
- {
- casReferenceId = (String)anErrorContext.get( AsynchAEMessage.CasReference);
- }
- String endpointName = getEndpointName(aController, anErrorContext);
- t.printStackTrace();
+public class AnalysisEngineProcessExceptionHandler extends ErrorHandlerBase implements ErrorHandler {
+ private static final Class CLASS_NAME = AnalysisEngineProcessExceptionHandler.class;
+
+ public AnalysisEngineProcessExceptionHandler(Map anEndpointThreasholdMap) {
+ super(anEndpointThreasholdMap);
+ }
+
+ public AnalysisEngineProcessExceptionHandler() {
+ }
+
+ public boolean handleError(Throwable t, ErrorContext anErrorContext,
+ AnalysisEngineController aController) {
+ if (t instanceof AnalysisEngineProcessException) {
+ String casReferenceId = null;
+ if (anErrorContext.containsKey(AsynchAEMessage.CasReference)) {
+ casReferenceId = (String) anErrorContext.get(AsynchAEMessage.CasReference);
+ }
+ String endpointName = getEndpointName(aController, anErrorContext);
+ t.printStackTrace();
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
- "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_process_exception__INFO",
- new Object[] { endpointName, casReferenceId, t.getLocalizedMessage() });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "handleError",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_process_exception__INFO",
+ new Object[] { endpointName, casReferenceId, t.getLocalizedMessage() });
}
-
-
- if (!super.exceedsThreshold(Monitor.ProcessErrorCount, endpointName, aController))
- {
- // This will drop the cas and clear the cache entry if the controller is Primitive and the service is not collocated with an Aggregate
- if ( aController instanceof PrimitiveAnalysisEngineController && aController.isTopLevelComponent())
- {
- aController.takeAction( ErrorHandler.DROPCAS, endpointName, anErrorContext);
- }
- }
- else
- {
- String action = getAction(Monitor.ProcessErrorCount, endpointName);
- aController.takeAction( action, endpointName, anErrorContext);
- }
- return true;
- }
- return false;
- }
+ if (!super.exceedsThreshold(Monitor.ProcessErrorCount, endpointName, aController)) {
+ // This will drop the cas and clear the cache entry if the controller is Primitive and the
+ // service is not collocated with an Aggregate
+ if (aController instanceof PrimitiveAnalysisEngineController
+ && aController.isTopLevelComponent()) {
+ aController.takeAction(ErrorHandler.DROPCAS, endpointName, anErrorContext);
+ }
+ } else {
+ String action = getAction(Monitor.ProcessErrorCount, endpointName);
+ aController.takeAction(action, endpointName, anErrorContext);
+ }
+ return true;
+ }
+ return false;
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AsynchAEExceptionHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AsynchAEExceptionHandler.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AsynchAEExceptionHandler.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/AsynchAEExceptionHandler.java Wed Sep 2 15:23:08 2009
@@ -26,17 +26,15 @@
import org.apache.uima.aae.error.ErrorHandlerBase;
import org.apache.uima.aae.error.MessageTimeoutException;
-public class AsynchAEExceptionHandler extends ErrorHandlerBase implements ErrorHandler
-{
- public boolean handleError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController)
- {
- if (t instanceof AsynchAEException)
- {
- //System.out.println("AsynchAEException Stack::\n");
- t.printStackTrace();
-
- }
- return false;
- }
+public class AsynchAEExceptionHandler extends ErrorHandlerBase implements ErrorHandler {
+ public boolean handleError(Throwable t, ErrorContext anErrorContext,
+ AnalysisEngineController aController) {
+ if (t instanceof AsynchAEException) {
+ // System.out.println("AsynchAEException Stack::\n");
+ t.printStackTrace();
+
+ }
+ return false;
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/CpcErrorHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/CpcErrorHandler.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/CpcErrorHandler.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/CpcErrorHandler.java Wed Sep 2 15:23:08 2009
@@ -35,89 +35,82 @@
import org.apache.uima.aae.monitor.Monitor;
import org.apache.uima.util.Level;
-public class CpcErrorHandler extends ErrorHandlerBase implements ErrorHandler
-{
- private static final Class CLASS_NAME = CpcErrorHandler.class;
-
- private Map delegateMap = null;
-
- public CpcErrorHandler( Map aDelegateMap )
- {
- delegateMap = aDelegateMap;
- }
-
- public Map getEndpointThresholdMap()
- {
- return delegateMap;
- }
-
-
- public boolean handleError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController)
- {
-
- if ( !isHandlerForError(anErrorContext, AsynchAEMessage.CollectionProcessComplete) )
- {
- return false;
- }
+public class CpcErrorHandler extends ErrorHandlerBase implements ErrorHandler {
+ private static final Class CLASS_NAME = CpcErrorHandler.class;
+
+ private Map delegateMap = null;
+
+ public CpcErrorHandler(Map aDelegateMap) {
+ delegateMap = aDelegateMap;
+ }
+
+ public Map getEndpointThresholdMap() {
+ return delegateMap;
+ }
+
+ public boolean handleError(Throwable t, ErrorContext anErrorContext,
+ AnalysisEngineController aController) {
+
+ if (!isHandlerForError(anErrorContext, AsynchAEMessage.CollectionProcessComplete)) {
+ return false;
+ }
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
- UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", t);
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", t);
}
- Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
- if ( endpoint != null )
- {
- Threshold threshold = null;
- if ( aController instanceof PrimitiveAnalysisEngineController )
- {
- threshold = (Threshold)delegateMap.get("");
- }
- else
- {
- threshold = super.getThreshold(endpoint, delegateMap, aController);
- }
- try
- {
- if ( aController instanceof AggregateAnalysisEngineController )
- {
- endpoint = ((AggregateAnalysisEngineController)aController).getClientEndpoint();
- }
- aController.getOutputChannel().sendReply(t, null, null, endpoint, AsynchAEMessage.CollectionProcessComplete);
- }
- catch( Exception e)
- {
+ Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
+ if (endpoint != null) {
+ Threshold threshold = null;
+ if (aController instanceof PrimitiveAnalysisEngineController) {
+ threshold = (Threshold) delegateMap.get("");
+ } else {
+ threshold = super.getThreshold(endpoint, delegateMap, aController);
+ }
+ try {
+ if (aController instanceof AggregateAnalysisEngineController) {
+ endpoint = ((AggregateAnalysisEngineController) aController).getClientEndpoint();
+ }
+ aController.getOutputChannel().sendReply(t, null, null, endpoint,
+ AsynchAEMessage.CollectionProcessComplete);
+ } catch (Exception e) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
- UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", e);
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
+ "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_exception__WARNING", e);
}
- }
+ }
- if ( threshold != null && threshold.getAction().equalsIgnoreCase(ErrorHandler.TERMINATE ))
- {
- aController.takeAction(threshold.getAction(), endpoint.getEndpoint(), anErrorContext);
- }
- else if ( threshold == null )
- {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_no_threshold_for_endpoint__CONFIG", new Object[] { aController.getName(), "Collection Processing Complete", aController.getName() });
- }
- }
- }
- else
- {
+ if (threshold != null && threshold.getAction().equalsIgnoreCase(ErrorHandler.TERMINATE)) {
+ aController.takeAction(threshold.getAction(), endpoint.getEndpoint(), anErrorContext);
+ } else if (threshold == null) {
+ if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG)) {
+ UIMAFramework.getLogger(CLASS_NAME).logrb(
+ Level.CONFIG,
+ getClass().getName(),
+ "handleError",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_no_threshold_for_endpoint__CONFIG",
+ new Object[] { aController.getName(), "Collection Processing Complete",
+ aController.getName() });
+ }
+ }
+ } else {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_no_endpoint_for_getmeta_retry__INFO", new Object[] { aController.getName()});
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(), "handleError",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_no_endpoint_for_getmeta_retry__INFO",
+ new Object[] { aController.getName() });
}
- }
- return true;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args)
- {
- // TODO Auto-generated method stub
+ }
+ return true;
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
- }
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultDelegateErrorHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultDelegateErrorHandler.java?rev=810558&r1=810557&r2=810558&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultDelegateErrorHandler.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/DefaultDelegateErrorHandler.java Wed Sep 2 15:23:08 2009
@@ -30,38 +30,35 @@
import org.apache.uima.aae.message.AsynchAEMessage;
import org.apache.uima.util.Level;
-public class DefaultDelegateErrorHandler extends ErrorHandlerBase implements ErrorHandler
-{
- private static final Class CLASS_NAME = DefaultDelegateErrorHandler.class;
+public class DefaultDelegateErrorHandler extends ErrorHandlerBase implements ErrorHandler {
+ private static final Class CLASS_NAME = DefaultDelegateErrorHandler.class;
- public boolean handleError(Throwable t, ErrorContext anErrorContext, AnalysisEngineController aController)
- {
-
- if ( t instanceof UimaEEServiceException)
- {
- t.printStackTrace();
+ public boolean handleError(Throwable t, ErrorContext anErrorContext,
+ AnalysisEngineController aController) {
+
+ if (t instanceof UimaEEServiceException) {
+ t.printStackTrace();
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
- UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", new Object[] { t });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
+ "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_exception__WARNING", new Object[] { t });
}
- if ( anErrorContext.containsKey(AsynchAEMessage.Endpoint) )
- {
- Endpoint endpoint = (Endpoint)anErrorContext.get(AsynchAEMessage.Endpoint);
- String casReferenceId = (String)anErrorContext.get(AsynchAEMessage.CasReference);
- String parentCasReferenceId = (String)anErrorContext.get(AsynchAEMessage.InputCasReference);
+ if (anErrorContext.containsKey(AsynchAEMessage.Endpoint)) {
+ Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
+ String casReferenceId = (String) anErrorContext.get(AsynchAEMessage.CasReference);
+ String parentCasReferenceId = (String) anErrorContext
+ .get(AsynchAEMessage.InputCasReference);
- try
- {
- aController.getOutputChannel().sendReply(t, casReferenceId, parentCasReferenceId, endpoint, AsynchAEMessage.Process );
- }
- catch( Throwable e)
- {
- e.printStackTrace();
- }
- }
- return true;
- }
- return false;
- }
+ try {
+ aController.getOutputChannel().sendReply(t, casReferenceId, parentCasReferenceId,
+ endpoint, AsynchAEMessage.Process);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ return true;
+ }
+ return false;
+ }
}