Package org.apache.uima.aae.error

Examples of org.apache.uima.aae.error.ErrorContext


  public ErrorHandlerChain getErrorHandlerChain() {
    return errorHandlerChain;
  }

  public void handleError(HashMap aMap, Throwable e) {
    ErrorContext errorContext = new ErrorContext();
    errorContext.add(aMap);
    getErrorHandlerChain().handle(e, errorContext, this);

  }
View Full Code Here


              "UIMAEE_exception__WARNING", e);
      try {
        sendReplyWithShutdownException(aCasReferenceId);

        // getInProcessCache().destroy();
        ErrorContext ec = new ErrorContext();
        ec.add(ErrorContext.THROWABLE_ERROR, e);
        ec.add(AsynchAEMessage.CasReference, aCasReferenceId);
        handleAction(ErrorHandler.TERMINATE, null, ec);
      } catch (Exception ex) {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                  "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_service_exception_WARNING", getComponentName());

          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                  "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_exception__WARNING", e);
        }
      }
      return;
    }
    if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
              "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_step__FINEST",
              new Object[] { getComponentName(), aCasReferenceId });
    }
    try {
      if (step instanceof SimpleStep) {
        simpleStep((SimpleStep) step, aCasReferenceId);
      } else if (step instanceof ParallelStep) {
        parallelStep((ParallelStep) step, aCasReferenceId);
      } else if (step instanceof FinalStep) {
        // Special case: check if this CAS has just been produced by a Cas Multiplier.
        // If so, we received a new CAS but there are no delegates in the pipeline.
        // The CM was the last in the flow. In this case, set a property in the cache
        // to simulate receipt of the reply to this CAS. This is so that the CAS is
        // released in the finalStep() when the Aggregate is not a Cas Multiplier.
        if (newCAS) {
          CasStateEntry casStateEntry = localCache.lookupEntry(aCasReferenceId);
          if (casStateEntry != null) {
            casStateEntry.setReplyReceived();
          }
        }
        finalStep((FinalStep) step, aCasReferenceId);
      } else {
        //  catch all case. If we are here, there is a fatal configuration problem of the
        //  flow controller
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.SEVERE, CLASS_NAME.getName(),
                  "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_invalid_step__SEVERE",
                  new Object[] { getComponentName(), step, aCasReferenceId });
        throw new UIMARuntimeException(new Exception("Invalid Flow Step:"+step+" Object. Check Descriptor For Invalid AE Key" ));
      }
      if ( UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
                  "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_completed_step__FINEST",
                  new Object[] { getComponentName(), aCasReferenceId });
      }

    } catch (Exception e) {
//      HashMap map = new HashMap();
//      map.put(AsynchAEMessage.Command, AsynchAEMessage.Process);
//      map.put(AsynchAEMessage.CasReference, aCasReferenceId);
      ErrorContext ec = new ErrorContext();
      ec.add(ErrorContext.THROWABLE_ERROR, e);
      ec.add(AsynchAEMessage.CasReference, aCasReferenceId);
      try {
        handleAction(ErrorHandler.TERMINATE, null, ec);
      } catch( Exception ex) {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
View Full Code Here

    } catch (Exception e) {
      if (delegate != null && aCommand == AsynchAEMessage.GetMeta) {
        delegate.cancelDelegateGetMetaTimer();
      }
      // Handle the error
      ErrorContext errorContext = new ErrorContext();
      errorContext.add(AsynchAEMessage.Command, aCommand);
      errorContext.add(AsynchAEMessage.Endpoint, anEndpoint);
      getAnalysisEngineController().getErrorHandlerChain().handle(e, errorContext,
              getAnalysisEngineController());
    }
  }
View Full Code Here

        if (ic != null && delegate != null && delegate.getEndpoint() != null) {
          ic.destroyListener(delegate.getEndpoint().getDestination().toString(), endpoint
                  .getDelegateKey());
        }
        // Setup error context and handle failure in the error handler
        ErrorContext errorContext = new ErrorContext();
        errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
        errorContext.add(AsynchAEMessage.CasReference, entry.getCasReferenceId());
        errorContext.add(AsynchAEMessage.Endpoint, endpoint);
        errorContext.handleSilently(true); // dont dump exception to the log
        // Failure on send treat as timeout
        delegate.handleError(new MessageTimeoutException(), errorContext);
      }

    }
View Full Code Here

    // the message. Messages accumulate in the service queue until the
    // service becomes available. When this happens, the service
    // will pickup messages from the queue, process them and send respones
    // to an appropriate response queue. Most likely such
    // respones should be thrown away. Well perhaps logged first.
    ErrorContext errorContext = new ErrorContext();
    errorContext.add(AsynchAEMessage.CasReference, aCasReferenceId);
    errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
    errorContext.add(AsynchAEMessage.Endpoint, anEndpoint);
    AnalysisEngineController controller = getController();
    controller.getErrorHandlerChain().handle(new ExpiredMessageException(), errorContext,
            controller);

  }
View Full Code Here

                  new Object[] { getController().getComponentName(), key, casReferenceId });
        }
        // The reply came late. The CAS was removed from the cache.
        return;
      }
      ErrorContext errorContext = new ErrorContext();
      errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
      errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
      errorContext.add(AsynchAEMessage.Endpoint, aMessageContext.getEndpoint());
      getController().getErrorHandlerChain().handle(e, errorContext, getController());
    } finally {
      incrementDelegateProcessCount(aMessageContext);
    }
View Full Code Here

        throw new AsynchAEException("CAS with Reference Id:" + casReferenceId
                + " Not Found in CasManager's CAS Cache");
      }
    } catch (Exception e) {

      ErrorContext errorContext = new ErrorContext();
      errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
      errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
      errorContext.add(AsynchAEMessage.Endpoint, aMessageContext.getEndpoint());
      getController().getErrorHandlerChain().handle(e, errorContext, getController());
    } finally {
      incrementDelegateProcessCount(aMessageContext);
      if (getController() instanceof AggregateAnalysisEngineController) {
        try {
View Full Code Here

                  .getUimaContextAdmin().getQualifiedContextName();
        }
        Exception remoteException = new UimaAsDelegateException("----> Controller:"
                + controllerName + " Received Exception " + casid_msg + " From Delegate:"
                + delegateKey, (Exception) object);
        ErrorContext errorContext = new ErrorContext();
        errorContext.add(AsynchAEMessage.Command, aMessageContext
                .getMessageIntProperty(AsynchAEMessage.Command));
        errorContext.add(AsynchAEMessage.MessageType, aMessageContext
                .getMessageIntProperty(AsynchAEMessage.MessageType));
        if (!isCpCError) {
          errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
        }
        errorContext.add(AsynchAEMessage.Endpoint, aMessageContext.getEndpoint());
        getController().getErrorHandlerChain().handle(remoteException, errorContext,
                getController());
      }
    } catch (Exception e) {
      ErrorContext errorContext = new ErrorContext();
      errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
      errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
      errorContext.add(AsynchAEMessage.Endpoint, aMessageContext.getEndpoint());
      getController().getErrorHandlerChain().handle(e, errorContext, getController());
    }

  }
View Full Code Here

      if (getController() instanceof AggregateAnalysisEngineController) {
        ((AggregateAnalysisEngineController) getController())
                .processCollectionCompleteReplyFromDelegate(delegateKey, true);
      }
    } catch (Exception e) {
      ErrorContext errorContext = new ErrorContext();
      errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.CollectionProcessComplete);
      errorContext.add(AsynchAEMessage.Endpoint, aMessageContext.getEndpoint());
      getController().getErrorHandlerChain().handle(e, errorContext, getController());
    }

  }
View Full Code Here

        public void run() {
          if ( delegateEntry.usesDedicatedTimerThread) {
              delegateEntry.getDelegateTimer().cancel();
            }
         
          ErrorContext errorContext = new ErrorContext();
          errorContext.add(AsynchAEMessage.Command, aCommand);
          String enrichedMessage = enrichProcessCASTimeoutMessage(aCommand, aCasReferenceId,timeToWait,"Delegate Service:"+delegateKey+" Has Timed Out While Processing CAS:"+aCasReferenceId );
          Exception cause = new MessageTimeoutException(enrichedMessage);
          if (AsynchAEMessage.Process == aCommand) {
            if ( delegate.getMetaReceiptTime() == 0 || ( (delegate.getMetaReceiptTime() + timeToWait) < System.currentTimeMillis() )) {
                delegate.setState(TIMEOUT_STATE);
            }
            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
                      "Delegate.TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                      "UIMAEE_cas_timeout_no_reply__WARNING",
                      new Object[] { delegate.getKey(), timeToWait, aCasReferenceId });
            }
            errorContext.add(AsynchAEMessage.CasReference, aCasReferenceId);
            errorContext.add(ErrorContext.THROWABLE_ERROR, cause);
/*  4/24/ Commented out. There is a dedicated timer for Ping timeouts
            //  Check if this is a Ping timeout and associate this with
            //  the oldest CAS from the list of CASes pending reply.
            if (isAwaitingPingReply() && getCasPendingReplyListSize() > 0) {
              String casReferenceId = getOldestCasIdFromOutstandingList();
              errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
              // Override the command to make sure this timeout is handled
              // by the ProcessCasErrorHandler.
              errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
              errorContext.add(AsynchAEMessage.ErrorCause, AsynchAEMessage.PingTimeout);
            }
*/           
          } else if (AsynchAEMessage.GetMeta == aCommand) {
            delegate.setState(TIMEOUT_STATE);
            if ( aCasReferenceId != null ) {  // true on GetMeta Ping timeout
                errorContext.add(AsynchAEMessage.CasReference, aCasReferenceId);
                errorContext.add(AsynchAEMessage.ErrorCause, AsynchAEMessage.PingTimeout);
            }
            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
                      "Delegate.TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                      "UIMAEE_meta_timeout_no_reply__WARNING",
                      new Object[] { delegate.getKey(), timeToWait });
            }
          } else if (AsynchAEMessage.CollectionProcessComplete == aCommand) {
            delegate.setState(TIMEOUT_STATE);
            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
                      "Delegate.TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                      "UIMAEE_cpc_timeout_no_reply__WARNING",
                      new Object[] { delegate.getKey(), timeToWait });
            }

          } else {
            delegate.setState(TIMEOUT_STATE);
          }
          errorContext.add(AsynchAEMessage.Endpoint, getEndpoint());
          handleError(cause, errorContext);
        }
      }, timeToRun);
      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, this.getClass().getName(),
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.error.ErrorContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.